DSA Arrays, Bubble sort and linked list

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/43

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

Array

a data structure used to store multiple elements.

2
New cards

Bubble Sort

an algorithm that sorts an array from the lowest value to the highest value.

3
New cards

Bubble up

The word 'Bubble' comes from how this algorithm works, it makes the highest values '______’.

4
New cards

Linked list

consists of nodes with some sort of data, and a pointer, or link, to the next node.

5
New cards

Singly linked lists, Doubly liked lists and Circular linked lists

what are the three basic forms of linked lists

6
New cards

Singly linked list

the simplest kind of linked lists. It takes up less space in memory because each node has only one address to the next node

7
New cards

Doubly linked list

has nodes with addresses to both the previous and the next node, like in the image below, and therefore takes up more memory.

8
New cards

Circular linked list

its like a singly or doubly linked list with the first node, the "head", and the last node, the "tail", connected.

9
New cards

Singly linked list

Doubly linked list

Circular singly linked list

Circular doubly linked list

What are the basic implementation of linked list

10
New cards

Traversal

Remove a node

Insert a node

Sort

what are the basic things we can do with linked lists

11
New cards

Traversing

a linked list means to go through the linked list by following the links from one node to the next.

12
New cards

Inserting a node

a linked list is very similar to deleting a node, because in both cases we need to take care of the next pointers to make sure we do not break the linked list.

13
New cards

Linear search

linked lists works the same as for arrays. A list of unsorted values are traversed from the head node until the node with the specific value is found. Time complexity is O(n)

14
New cards

Binary search

not possible for linked lists because the algorithm is based on jumping directly to different array elements, and that is not possible with linked lists.

15
New cards

Tree data structure

similar to Linked Lists in that each node contains data and can be linked to other nodes.

16
New cards

Hierarchical Data

File systems, organizational models, etc.

17
New cards

Databases

Used for quick data retrieval.

18
New cards

Routing Tables

Used for routing data in network algorithms.

19
New cards

Sorting/Searching

Used for sorting data and searching for data.

20
New cards

Priority Queues

Priority queue data structures are commonly implemented using trees, such as binary heaps.

21
New cards

Binary Trees

Each node has up to two children, the left child node and the right child node. This structure is the foundation for more complex tree types like Binay Search Trees and AVL Trees.

22
New cards

Binary Search Trees

A type of Binary Tree where for each node, the left child node has a lower value, and the right child node has a higher value.

23
New cards

AVL Trees

A type of Binary Search Tree that self-balances so that for every node, the difference in height between the left and right subtrees is at most one. This balance is maintained through rotations when nodes are inserted or deleted.

24
New cards

Binary Tree

a type of tree data structure where each node can have a maximum of two child nodes, a left child node and a right child node.

25
New cards

Array

Linked lists

Binary trees

Benefits of Binary Trees over Arrays and Linked Lists:

  • _____are fast when you want to access an element directly, like element number 700 in an array of 1000 elements for example. But inserting and deleting elements require other elements to shift in memory to make place for the new element, or to take the deleted elements place, and that is time consuming.

  • ______ are fast when inserting or deleting nodes, no memory shifting needed, but to access an element inside the list, the list must be traversed, and that takes time.

  • ______ such as Binary Search Trees and AVL Trees, are great compared to Arrays and Linked Lists because they are BOTH fast at accessing a node, AND fast when it comes to deleting or inserting a node, with no shifts in memory needed.

26
New cards

balanced binary tree

It has at most 1 in difference between its left and right subtree heights, for each node in the tree.

27
New cards

complete binary tree

It has all levels full of nodes, except the last level, which is can also be full, or filled from left to right.

28
New cards

full binary tree

its a kind of tree where each node has either 0 or 2 child nodes

29
New cards

Perfect binary tree

It has all leaf nodes on the same level, which means that all levels are full of nodes, and all internal nodes have two child nodes.

30
New cards

Breadth First Search

when the nodes on the same level are visited before going to the next level in the tree. This means that the tree is explored in a more sideways direction.

31
New cards

Depth First Search

is when the traversal moves down the tree all the way to the leaf nodes, exploring the tree branch by branch in a downwards direction.

32
New cards

pre-order

in-order

post-order

three different types of DFS traversals

33
New cards

Binary Search Tree

a Binary Tree where every node's left child has a lower value, and every node's right child has a higher value.

34
New cards

Binary Search Tree

a type of Binary Tree data structure, where the following properties must be true for any node "X" in the tree:

  • The X node's left child and all of its descendants (children, children's children, and so on) have lower values than X's value.

  • The right child, and all its descendants have higher values than X's value.

  • Left and right subtrees must also be Binary Search Trees.

35
New cards

subtree

A ______starts with one of the nodes in the tree as a local root, and consists of that node and all its descendants.

36
New cards

descendants

The _________of a node are all the child nodes of that node, and all their child nodes, and so on.

37
New cards

node's in-order successor

A is the node that comes after it if we were to do in-order traversal.

38
New cards
39
New cards
40
New cards
41
New cards
42
New cards
43
New cards
44
New cards