Python Linear Data Structures

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/54

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.

55 Terms

1
New cards

Array

_____ is a container which can hold a fix number of items and these items should be of the same type.

2
New cards

Arrays

Most of the data structures make use of _______ to implement their algorithms.

3
New cards

Element

Each item stored in an array is called an _______

4
New cards

Index

Each location of an element in an array has a numerical _______, which is used to identify the element.

5
New cards

Traverse

print all the array elements one by one

6
New cards

Insertion

Adds an element at the given index.

7
New cards

Deletion

Deletes an element at the given index.

8
New cards

Search

Searches an element using the given index or by the value.

9
New cards

Update

Updates an element at the given index

10
New cards

importing

Array is created in Python by ______ array module to the python program

11
New cards

Typecode

_________ are the codes that are used to define the type of value the array will hold.

12
New cards

b

Represents signed integer of size 1 byte

13
New cards

B

Represents unsigned integer of size 1 byte

14
New cards

u

Represents character of size 2 bytes

15
New cards

i

Represents signed integer of size 2 bytes

16
New cards

I

Represents unsigned integer of size 2 bytes

17
New cards

f

Represents floating point of size 4 bytes

18
New cards

d

Represents floating point of size 8 bytes

19
New cards

lists

In Python, we can treat _____ as arrays. However, we cannot constrain the type of elements stored in this.

20
New cards

stack

A ______ is a linear data structure that follows the principle of Last In First Out (LIFO).

21
New cards

Last In First Out (LIFO)

This means the last element inserted inside the stack is removed first.

22
New cards

stack

You can think of the ______ data structure as the pile of plates on top of another.

23
New cards

push, pop

In programming terms, putting an item on top of the stack is called _____ and removing an item is called _____.

24
New cards

Push

Add an element to the top of a stack

25
New cards

Pop

Remove an element from the top of a stack

26
New cards

IsEmpty

Check if the stack is empty

27
New cards

IsFull

Check if the stack is full

28
New cards

Peek

Get the value of the top element without removing it

29
New cards

TOP

A pointer called ___ is used to keep track of the top element in the stack

30
New cards

-1, TOP == -1

When initializing the stack, we set its value to ___ so that we can check if the stack is empty by comparing _____

31
New cards

pushing

On _______ an element, we increase the value of TOP and place the new element in the position pointed to by TOP

32
New cards

popping

On _______ an element, we return the element pointed to by TOP and reduce its value

33
New cards

full

Before pushing, we check if the stack is already _____

34
New cards

empty

Before popping, we check if the stack is already ______

35
New cards

queue

A _____ is a useful data structure in programming. It is similar to the ticket queue outside a cinema hall, where the first person entering the queue is the first person who gets the ticket.

36
New cards

First In First Out (FIFO) rule

Queue follows the _______, the item that goes in first is the item that comes out first.

37
New cards

enqueue, dequeue

In programming terms, putting items in the queue is called _____, and removing items from the queue is called ______.

38
New cards

an abstract data structure - ADT

A queue is an object (___________)

39
New cards

Enqueue

Add an element to the end of the queue

40
New cards

Dequeue

Remove an element from the front of the queue

41
New cards

IsEmpty

Check if the queue is empty

42
New cards

IsFull

Check if the queue is full

43
New cards

Peek

Get the value of the front of the queue without removing it

44
New cards

simple queue

In a ________, insertion takes place at the rear and removal occurs at the front. It strictly follows the FIFO (First in First out) rule

45
New cards

circular queue

In a _______, the last element points to the first element making a circular link.

46
New cards

priority queue

A _______ is a special type of queue in which each element is associated with a priority and is served according to its priority.

47
New cards

order

If elements with the same priority occur, they are served according to their _____ in the queue.

48
New cards

Insertion, removal

_______ occurs based on the arrival of the values and ______ occurs based on priority.

49
New cards

double ended queue

In a _______, insertion and removal of elements can be performed from either from the front or rear. Thus, it does not follow the FIFO (First In First Out) rule.

50
New cards

linked list

In ______ data structure, data elements are connected through a series of nodes. And, each node contains the data items and address to the next node.

51
New cards

Singly Linked List

It is the most common. Each node has data and a pointer to the next node.

52
New cards

Doubly Linked List

Add a pointer to the previous node. Thus, it can go in either direction: forward or backward.

53
New cards

Circular Linked List

is a variation of a linked list in which the last element is linked to the first element. This forms a circular loop.

54
New cards

head

_____ points to the first node of the linked list

55
New cards

NULL

next pointer of the last node is _____, so if the next current node is _____, we have reached the end of the linked list.