ITEC33 (Ma'am Pamintuan) Flashcards

1
Q

is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out).

A

Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

insertion operation

A

PUSH

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

removal operation

A

POP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

STACK
Pushing (storing) an element on the stack.

A

push()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

STACK
Removing (accessing) an element from the stack.

A

pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

STACK
get the top data element of the stack, without removing it.

A

peek()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

STACK
check if stack is full.

A

isFull()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

STACK
check if stack is empty

A

isEmpty()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

pointer provides top value of the stack without actually removing it.

A

top

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The process of putting a new data element onto stack is known as a Push Operation. Push operation involves a series of steps −

Step 1− Checks if the stack is full.
Step 2− If the stack is full, produces an error
and exit.
Step 3− If the stack is not full, incrementstopto
point next empty space.
Step 4− Adds data element to the stack
location, where top is pointing.
Step 5− Returns success.

A

PUSH OPERATION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Accessing the content while removing it from the stack, is known as a Pop Operation. In an array implementation of pop() operation, the data element is not actually removed, insteadtopis decremented to a lower position in the stack to point to the next value. But in linked-list implementation, pop() actually removes data element and deallocates memory space.
Step 1− Checks if the stack is empty.
Step 2− If the stack is empty, produces an error and
exit.
Step 3− If the stack is not empty, accesses the data
element at whichtopis pointing.
Step 4− Decreases the value of top by 1.
Step 5− Returns success.

A

Pop Operation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The way to write arithmetic expression

A

notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

An arithmetic expression can be written in three different but equivalent notations

A

Infix Notation
Prefix (Polish) Notation
Postfix (Reverse-Polish) Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

where operators are usedin-between operands. It is easy for us humans to read, write, and speak in infix notation but the same does not go well with computing devices.

A

Infix Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In this notation, operator isprefixed to operands, i.e. operator is written ahead of operands.

A

Prefix Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Prefix notation is also known as

A

Polish Notation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

the operator is written after the operands.

A

Postfix Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

This notation style is known asReversed Polish Notation.

A

Postfix Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Step 1 − scan the expression from left to right
Step 2 − if it is an operand push it to stack
Step 3 − if it is an operator pull operand from stack and perform operation
Step 4 − store the output of step 3, back to stack
Step 5 − scan the expression until all operands are consumed
Step 6 − pop the stack and perform operation

A

Postfix Evaluation Algorithm

20
Q

Step 1 − scan the expression from right to left
Step 2 − if it is an operand push it to stack
Step 3 − if it is an operator pull operand from stack and perform operation
Step 4 − store the output of step 3, back to stack
Step 5 − scan the expression until all operands are consumed
Step 6 − pop the stack and perform operation

A

Prefix Evaluation Algorithm

21
Q

is an abstract data structure, somewhat similar to Stacks.

A

queue

22
Q

follows First-In-First-Out methodology

A

queue

23
Q

add (store) an item to the queue.

A

enqueue()

24
Q

remove (access) an item from the queue.

A

dequeue()

25
Q

Gets the element at the front of the queue without removing it.

A

peek()

26
Q

Checks if the queue is full.

A

isfull()

27
Q

Checks if the queue is empty.

A

isempty()

28
Q

Queues maintain two data pointers,frontandrear. Therefore, its operations are comparatively difficult to implement than that of stacks.
The following steps should be taken to enqueue (insert) data into a queue −
Step 1− Check if the queue is full.
Step 2− If the queue is full, produce overflow error and exit.
Step 3− If the queue is not full, incrementrearpointer to point the next empty space.
Step 4− Add data element to the queue location, where the rear is pointing.
Step 5− return success.

A

Enqueue Operation

29
Q

Accessing data from the queue is a process of two tasks − access the data wherefrontis pointing and remove the data after access. The following steps are taken to performdequeueoperation −
Step 1− Check if the queue is empty.
Step 2− If the queue is empty, produce underflow error and exit.
Step 3− If the queue is not empty, access the data wherefrontis pointing.
Step 4− Incrementfrontpointer to point to the next available data element.
Step 5− Return success.

A

Dequeue Operation

30
Q

is a very simple search algorithm.

In this type of search, a sequential search is made over all items one by one.
Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection.

A

Linear search

31
Q

is a fast search algorithm with run-time complexity of Ο(log n).

A

Binary search

32
Q

This search algorithm works on the principle of divide and conquer.

A

Binary search

33
Q

looks for a particular item by comparing the middle most item of the collection.

A

Binary search

34
Q

For this algorithm to work properly, the data collection should be in the sorted form.

A

Binary search

35
Q

is an improved variant of binary search. This search algorithm works on the probing position of the required value. For this algorithm to work properly, the data collection should be in a sorted form and equally distributed.

A

Interpolation search

36
Q

refers to arranging data in a particular format.

A

Sorting

37
Q

specifies the way to arrange data in a particular order. Most common orders are in numerical or lexicographical order.

A

Sorting

38
Q

is a simple sorting algorithm. This sorting algorithm is comparison-based algorithm in which each pair of adjacent elements is compared and the elements are swapped if they are not in order. This algorithm is not suitable for large data sets as its average and worst case complexity are of Ο(n2) wherenis the number of items

A

Bubble sort

39
Q

This is an in-place comparison-based sorting algorithm. Here, a sub-list is maintained which is always sorted.

A

Insertion sort

40
Q

is a simple sorting algorithm. This sorting algorithm is an in-place comparison-based algorithm in which the list is divided into two parts, the sorted part at the left end and the unsorted part at the right end. Initially, the sorted part is empty and the unsorted part is the entire list.

A

Selection sort

41
Q

is a sorting technique based on divide and conquer technique. With worst-case time complexity being Ο(n log n), it is one of the most respected algorithms.

A

Merge sort

42
Q

is a highly efficient sorting algorithm and is based on partitioning of array of data into smaller arrays.

A

QUICK SORT

43
Q

This algorithm is quite efficient for large-sized data sets as its average and worst-case complexity are O(nLogn) and O(n2), respectively.

A

QUICK SORT

44
Q

is a highly efficient sorting algorithm and is based on insertion sort algorithm. This algorithm avoids large shifts as in case of insertion sort, if the smaller value is to the far right and has to be moved to the far left.

A

Shell sort

45
Q

This algorithm uses insertion sort on a widely spread elements, first to sort them and then sorts the less widely spaced elements. This spacing is termed asinterval.

A

Shell sort

46
Q
A