- Practice Questions
- Given an array with some integer type values. Write a python script to sort array values.
- Given a list of heterogenous elements. Write a python script to remove all the non int values from the list.
- Write a Python script to calculate average of element of a list.
- Write a Python script to create a list of first N prime numbers.
- Write a Python script to create a list of first N terms of a Fibonacci series.
- Practice Questions
- Define a python class Person with instance object variables name and age. Set Instance object variables in _init() nethod. Also define show() method to display name and age of a person.
- Define a class Circle with instance object variable radius. Provide setter and getter for radius. Also define getArea() and getCircumference() methods.
- Define a class Rectangle with length and breadth as instance object variables. Provide setDimensions(), showDimensions() and getArea() method in it.
- Define a class Book with instance object variables bookid, title, and price. Initialise them via init() method. Also define method to show book variables.
- Define a class Team with instance object variable a list of team member names. Provide methods to input member names and display member names.
ππ END OF DAY1 ππ
- Practice Questions
- Define a class Node to describe a node of singly linked list.
- Define a class SLL to implement Singly Linked List with init() method to create and initialise start reference variable
- Define a method is_empty() to check if linked list is empty in SLL class.
- In class SLL, define a method insert_at_start() to insert an element at the starting of the list.
- In class SLL, define a method insert_at_last() to insert an element at the end of the list.
- In class SLL, define a method search() to search an node with specified element value.
- In class SLL, define a method insert_after() to insert new node after a given node of the list.
- In class SLL, define a method to print all the element of list.
- In class SLL, implement iterator for SLL to access all the elements of the list in a sequence.
- In class SLL, define a method delete_first() to delete first element from the list.
- In class SLL, define a method delete_last() to delete last element from the list.
- In class SLL, define a method delete_item() to delete specified element from the list.
ππ END OF DAY2 ππ
- Practice Questions
- Define a class Node to describe a node of Doubly linked list.
- Define a class DLL to implement Doubly Linked List with init() method to create and initialise start reference variable
- Define a method is_empty() to check if linked list is empty in DLL class.
- In class DLL, define a method insert_at_start() to insert an element at the starting of the list.
- In class DLL, define a method insert_at_last() to insert an element at the end of the list.
- In class DLL, define a method search() to search an node with specified element value.
- In class DLL, define a method insert_after() to insert new node after a given node of the list.
- In class DLL, define a method to print all the element of list.
- In class DLL, implement iterator for DLL to access all the elements of the list in a sequence.
- In class DLL, define a method delete_first() to delete first element from the list.
- In class DLL, define a method delete_last() to delete last element from the list.
- In class DLL, define a method delete_item() to delete specified element from the list.
ππ END OF DAY3 ππ
- Practice Questions
- Define a class Node to describe a node of Circular linked list.
- Define a class CLL to implement Circular Linked List with init() method to create and initialise last reference variable
- Define a method is_empty() to check if linked list is empty in CLL class.
- In class CLL, define a method insert_at_start() to insert an element at the starting of the list.
- In class CLL, define a method insert_at_last() to insert an element at the end of the list.
- In class CLL, define a method search() to search an node with specified element value.
- In class CLL, define a method insert_after() to insert new node after a given node of the list.
- In class CLL, define a method to print all the element of list.
- In class CLL, define a method delete_first() to delete first element from the list.
- In class CLL, define a method delete_last() to delete last element from the list.
- In class CLL, define a method delete_item() to delete specified element from the list.
- In class CLL, implement iterator for CLL to access all the elements of the list in a sequence.
ππ END OF DAY4 ππ
- Practice Questions
- Define a class Node to describe a node of Circular doubly linked list.
- Define a class CDLL to implement Circular Doubly Linked List with init() method to create and initialise start reference variable
- Define a method is_empty() to check if linked list is empty in CDLL class.
- In class CDLL, define a method insert_at_start() to insert an element at the starting of the list.
- In class CDLL, define a method insert_at_last() to insert an element at the end of the list.
- In class CDLL, define a method search() to search an node with specified element value.
- In class CDLL, define a method insert_after() to insert new node after a given node of the list.
- In class CDLL, define a method to print all the element of list.
- In class CDLL, define a method delete_first() to delete first element from the list.
- In class CDLL, define a method delete_last() to delete last element from the list.
- In class CDLL, define a method delete_item() to delete specified element from the list.
- In class CDLL, implement iterator for CDLL to access all the elements of the list in a sequence.
ππ END OF DAY5 ππ
- Practice questions on the GFG platform of Basic and Easy level.
ππ END OF DAY6 ππ
- Practice Questions
- Define a class Stack to implement stack data structure using list. Define init() method to create an empty list object as instance object member of Stack.
- Define a method is_empty() to check if the stack is empty in Stack class.
- In Stack class, define push() method to add data onto the stack.
- In Stack class, define pop() method to remove top element from the stack.
- In Stack class, define peak() method to return top element on the stack.
- In Stack class, define size() method to return the size of the stack that is number of element items present in the stack.
- Practice Questions
- Define a class Stack to implement stack data structure by extending list class.
- Define a method is_empty() to check if stack is empty in Stack class.
- In Stack class, define push() method to add data onto the stack.
- In Stack class, define pop() method to remove top element from the stack.
- In Stack class, define peak() method to return top element on the stack.
- In Stack class, define size() method to return size of the stack that is number of items present in the stack.
- Implement a way to restrict use of insert() method of list class from stack object.
ππ END OF DAY7 ππ
- Practice Questions
- Define a class Stack to implement stack data structure using Singly Linked List concept. Define init() method to initialise start reference variable and item_count variable to keep track of number of elements in stack.
- Define a method is_empty() to check if stack is empty in Stack class.
- In Stack class, define push() method to add data onto the stack.
- In Stack class, define pop() method to remove top element from the stack.
- In Stack class, define peak() method to return top element on the stack.
- In Stack class, define size() method to return size of the stack that is number of items present in the stack.
ππ END OF DAY8 ππ
- Practice Questions
- Import module containing singly linked list code in your python file.
- Define a class Stack to implement stack data structure. Define init() method to create Singly Linked List(SLL) object
- Define a method is_empty() to check if the stack is empty in Stack class.
- In Stack class, define push() method to add data onto the stack.
- In Stack class, define pop() method to remove top element from the stack.
- In Stack class, define peak() method to return top element on the stack.
- In Stack class, define size() method to return size of the stack that is number of items present in the stack.
- Practice Questions
- Import module containing singly linked list code in your python file.
- Define a class Stack to implement stack data structure by inheriting linked list class.
- Define a method is_empty() to check if the stack is empty in Stack class.
- In Stack class, define push() method to add data onto the stack.
- In Stack class, define pop() method to remove top element from the stack.
- In Stack class, define peak() method to return top element on the stack.
- In Stack class, define size() method to return size of the stack that is number of item present in stack.
ππ END OF DAY9 ππ
- Practice Questions
- Define a class Queue to implement queue data structure using list. Define init() method to create an empty list object as instance object member of Queue.
- Define a method is_empty() to check if the queue is empty in Queue class.
- In Queue class, define enqueue() method to add data at the rear end of the queue.
- In Queue class, define dequeue() method to remove front element from the queue.
- In Queue class, define get_front() method to return front element of the queue.
- In Queue class, define get_rear() method to return rear element of the queue.
- In Queue class, define size() method to return size of the queue that is number of items present in the queue.
ππ END OF DAY10 ππ
- Practice Questions
- Define a class Queue to implement queue data structure using singly linked list concept. Define init() method to initialise front and rear reference variable; and item_count variable to keep track of number of elements in the queue.
- Define a method is_empty() to check if the queue is empty in Queue class.
- In Queue class, define enqueue() method to add data into the queue.
- In Queue class, define dequeue() method to remove front element from the queue.
- In Queue class, define get_front() method to return front element of the queue.
- In Queue class, define get_rear() method to return rear element of the queue.
- In Queue class, define size() method to return size of the queue that is number of items present in the queue.
ππ END OF DAY11 ππ
- Practice Questions
- Define a class Deque to implement deque data structure using list. Define init() method to create an empty list object as instance object member of Deque.
- Define a method is_empty() to check if deque is empty in Deque class.
- In Deque class, define insert_front() method to add data at front end of the deque.
- In Deque class, define insert_rear() method to add data at rear end of the deque.
- In Deque class, define delete_front() method to remove front element from the deque.
- In Deque class, define delete_rear() method to remove rear element from the deque.
- In Deque class, define get_front() method to return front element of the deque.
- In Deque class, define get_rear() method to return rear element of the deque.
- In Deque class, define size() method to return size of the deque that is number of items present in deque.
- Practice Questions
- Define a class Node with instance object member Variables prev, item & next.
- Define a class Deque to implement deque data structure using doubly linked list concept. Define init() method to initialise front and rear reference variable; and item_count variable to keep trrack of number of elements in the deque.
- Define a method is_empty() to check if the Deque class.
- In Deque class, define insert_front() method to add data at front end of the deque.
- In Deque class, define insert_rear() method to add data at rear end of the deque.
- In Deque class, define delete_front() method to remove front element from the deque.
- In Deque class, define delete_rear() method to remove rear element from the deque.
- In Deque class, define get_front() method to return front element of the deque.
- In Deque class, define get_rear() method to return rear element of the deque.
- In Deque class, define size() method to return size of the deque that is number of items present in deque.
ππ END OF DAY12 ππ
- Practice Questions
- Define a class PriorityQueue to implement priority queue data structure using list. Provide init() method to create a list object (inittally empty).
- Define a push method in PriorityQueue class to insert new data with given priority.
- Define a pop method in PriorityQueue class, which returns the highest priority data stored in the priority queue data structure. Raise exception in priority queue is empty.
- Define a is_epmty method in PriorityQueue class to check if the priority queue is empty.
- In class PriorityQueue, define a method size to return the number of elements present in the priority queue.
- Practice Questions
- Define a Node class with instance member variables item, priority and next.
- Define a class PriorityQueue to implement priority queue data structure using singly linked list. Provide init() method to create a start reference variable (initially containing None) and item_count variable (initially 0).
- Define a push method in PriorityQueue class to insert new data with given priority.
- Define a pop method in PriorityQueue class, which returns the highest priority data stored in the priority queue data structure. Raise exception if priority queue is empty.
- Define a is_empty method in PriorityQueue class to check if priority queue is empty.
- In class PriorityQueue, define a method size to return the number of elements present in priority queue.
ππ END OF DAY13 ππ
- Practice Questions
- Write a recursion function to print first N natural numbers.
- Write a recursive function to print first N natural numbers in reverse order.
- Write a recursive function to print first N odd natural numbers.
- Write a recursive function to print first N even natural nubmers.
- Write a recursive function to print first N odd natural numbers in reverse order.
- Write a recursive function to print first N even natural nubmers in reverse order.
- Write a recursive function to calculate sum of first N natural numbers.
- Write a recursive function to calculate sum of first N odd natural numbers.
- Write a recursive function to calculate sum of first N even natural numbers.
- Write a recursive function to calculate factorial of a number.
- Write a recursive function to calculate sum of square of first N natural numbers.
ππ END OF DAY14 ππ
- Practice Questions
- Define a class Node with instance variables left, item, and right. The variables left and right are used to refer left and right child node. The item variable is used to hold data item.
- Define a class BST to implement Binary Search Tree data structure. Make init() method to create root instance variable to hold the reference of root node.
- In class BST, define insert method to store new data item in the binary search tree.
- In class BST, define a search method to find a given item in the binary search tree and return the node reference. It returns None if search failed.
- In class BST, define a method to implement inorder traversal.
- In class BST, define a method to implement preorder traversal.
- In class BST, define a method to implement postorder traversal.
ππ END OF DAY15 ππ
- Practice Questions
- In class BST, define a method to find minimum value item node.
- In class BST, define a method to find maximum value item node.
- In class BST, define a method to delete a node from binary search tree.
- In class BST, define a method size to return the number of elements present in the BST.
ππ END OF DAY16 ππ
- Practice Questions
- Write a class Graph to implement adjacency matrix representation of simple and undirectes graph.
- In class Graph, define init() method to initialise vertex_count and adj_matrix (list of lists)
- In class Graph, define add_edge() method add an edge in the graph with given weight.
- In class Graph, define remove_edge() method to remove an edge from the graph.
- In class Graph, define has_edge() method to check whether two given vertices are connected by an edge or not.
- In class Graph, define print_adj_matrix() method to print adjacency matrix.
- Practice Questions
- Write a class Graph to implement list representation of graph data structure.
- In class Graph, define init() method to initialise instance object variable vertex_count and a dict adj_list where key is vertex number and value is a list of adjacent vertices.
- In class Graph, define add_edge() method add an edge in the graph with given vertices and weight.
- In class Graph, define remove_edge() method to remove an edge from the graph.
- In class Graph, define has_edge() method to check whether an edge exists or not for a given pair of vertices.
- In class Graph, define print_adj_list() method to print adjacency list of graph.
ππ END OF DAY17 ππ
- Practice Questions
- Write a python function to implement bubble sort.
- Write a python function to implement modified bubble sort.
- Practice Question
- Write a python function to implement selection sort.
ππ END OF DAY18 ππ
- Practice Question
- Write a python function to implement Insertion sort
ππ END OF DAY19 ππ
- Practice Question
- Write a python function to implement quick sort.
- Practice Question
- Write a python function to implement merge sort.
ππ END OF DAY20 ππ
- Practice Question
- Define a class Heap to implement Heap data structure with init method to create empty heap list.
- In class Heap, define a method to create a heap from a given list of element.
- In class Heap, define a method insert to insert a given element in the heap at appropriate position.
- In class Heap, define a top method which returns the top element of heap. Raise an exception if Heap is empty.
- Define a class EmptyHeapException to describe custom exception.
- In class Heap, define a method delete which delete the top element and returns it. Raise an exception if Heap is empty.
- In class Heap, define a method heapSort to sort a given list with help of heap.
ππ END OF DAY21 ππ
- Practice Questions
- Write a python function to implement Linear Search.
- Write a python function to implement Binary Search.
ππ END OF DAY22 ππ