DSA PreFi

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/48

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.

49 Terms

1
New cards

Stack

An abstract data type that follows the LIFO (Last In, First Out) principle where the last item added is the first to be removed.

2
New cards

Push

The operation that inserts or adds an element onto the top of the stack.

3
New cards

Pop

The operation that removes the top element from the stack.

4
New cards

Peek (Top)

The operation that returns the top element of the stack without removing it.

5
New cards

Underflow

An error that occurs when attempting to pop an element from an empty stack.

6
New cards

Overflow

An error that occurs when attempting to push an element into a full stack.

7
New cards

Applications of Stack

Used in expression evaluation, function calls, backtracking algorithms, and undo mechanisms.

8
New cards

Postfix Expression

An arithmetic expression where the operator follows the operands (e.g., AB+).

9
New cards

Prefix Expression

An arithmetic expression where the operator precedes the operands (e.g., +AB).

10
New cards

Infix Expression

An arithmetic expression where the operator is written between the operands (e.g., A + B).

11
New cards

Stack Implementation Using Array

Stack is implemented using an array with a variable “top” to track the top index.

12
New cards

Stack Implementation Using Linked List

Stack is implemented using nodes where each node contains data and a pointer to the next node.

13
New cards

Queue

An abstract data type that follows the FIFO (First In, First Out) principle where the first element inserted is the first to be removed.

14
New cards

Enqueue

The operation that inserts or adds an element at the rear of the queue.

15
New cards

Dequeue

The operation that removes an element from the front of the queue.

16
New cards

Front

The position of the first element in the queue.

17
New cards

Rear

The position of the last element in the queue.

18
New cards

Circular Queue

A variation of a queue where the last position is connected back to the first position to make a circle.

19
New cards

Priority Queue

A queue where each element is associated with a priority and served based on priority rather than arrival order.

20
New cards

Double-Ended Queue (Deque)

A queue that allows insertion and deletion of elements from both ends.

21
New cards

Queue Underflow

Error condition that occurs when attempting to remove an element from an empty queue.

22
New cards

Queue Overflow

Error condition that occurs when attempting to add an element to a full queue.

23
New cards

Queue Implementation Using Array

Queue implemented with an array and front/rear pointers to manage insertion and deletion.

24
New cards

Queue Implementation Using Linked List

Queue implemented using nodes with pointers to the next node for dynamic memory allocation.

25
New cards

Linked List

A linear data structure where each element (node) contains data and a reference (pointer) to the next node.

26
New cards

Node

The basic unit of a linked list that contains data and a pointer to the next node.

27
New cards

Head

The first node in a linked list.

28
New cards

Tail

The last node in a linked list whose next pointer is null.

29
New cards

Singly Linked List

A linked list where each node points only to the next node.

30
New cards

Doubly Linked List

A linked list where each node has two pointers: one pointing to the next node and one to the previous node.

31
New cards

Circular Linked List

A linked list where the last node points back to the first node, forming a circle.

32
New cards

Advantages of Linked List

Dynamic memory allocation, ease of insertion/deletion without shifting elements.

33
New cards

Disadvantages of Linked List

Requires extra memory for pointers and has sequential access only.

34
New cards

Insertion in Linked List

Adding a new node by adjusting the pointers between existing nodes.

35
New cards

Deletion in Linked List

Removing a node by adjusting the pointers of the surrounding nodes.

36
New cards

Traversal in Linked List

Visiting each node of the linked list sequentially to access or display data.

37
New cards

Search in Linked List

Finding a node by comparing its data with the target value.

38
New cards

Stack vs Queue

Stack is LIFO; Queue is FIFO.

39
New cards

Recursion

A function that calls itself directly or indirectly to solve a problem.

40
New cards

Base Case

The condition in recursion that stops further recursive calls.

41
New cards

Recursive Case

The part of the recursion where the function calls itself with modified parameters.

42
New cards

Direct Recursion

When a function calls itself directly.

43
New cards

Indirect Recursion

When a function calls another function that calls the first one again.

44
New cards

Tail Recursion

When the recursive call is the last operation in the function.

45
New cards

Non-Tail Recursion

When the recursive call is followed by another operation.

46
New cards

Advantages of Recursion

Reduces code size, simplifies problems like tree traversal and factorial.

47
New cards

Disadvantages of Recursion

Uses more memory and has risk of stack overflow for deep recursion.

48
New cards

Call Stack

A structure that stores information about active subroutines/functions including parameters, return addresses, and local variables.

49
New cards

Applications of Recursion

Used in sorting algorithms (quick sort, merge sort), tree traversal, and backtracking problems.