
Implement stacks using lists by building push and pop operations, tracking the top element, and managing capacity within the stack.
Implement a stack using a linked list in Python by creating nodes, linking them, pushing at the head, and popping the top element.
Learn how to balance brackets using a stack-based algorithm that pushes open symbols, pops matching closes, and verifies balance for expressions with multiple bracket types.
Convert an infix expression to postfix using a stack, pushing operands and operators, handling open and closed brackets, and finally popping remaining operators to produce the postfix expression.
Build a postfix expression evaluator using a stack; push operands, pop two values for each operator, perform the operation, and push the result to reveal the final value.
Push each character of the input string onto a stack, then pop and compare with the original sequence to determine if the string is a palindrome.
Reverse a given stack by transferring elements from the old stack to a new stack using push and pop operations, checking for emptiness and handling recursive and non-recursive approaches.
Explore the concept of a singly linked list, where each node stores data and a next reference, and learn operations such as insert, append, delete, and size.
Write a program that inserts a new node at the beginning of a singly linked list, setting the new node's next to the current head and updating the head pointer.
Traverse the linked list to the end, create a new node, and link the last node to it. If the list is empty, set the new node as head.
Insert a new node after a given position in a singly linked list by traversing to that position and updating pointers. Handle end-of-list and invalid positions to maintain list integrity.
Demonstrates deleting the head node of a singly linked list by updating the head to the second node and relinking the remaining nodes, using a, b, and c.
Learn to delete the last node of a singly linked list in Python by traversing to the last but one node and updating pointers.
Learn how to delete a node at a given position in a singly linked list by locating the previous node, adjusting next pointers, and handling head cases.
Learn to search a node in a linked list by traversing from the head, comparing each node's data to a target value, and signaling when a match is found.
Implement a program to compute the size of a single linked list by traversing from the head, counting nodes, and returning the final size.
Explore the concept of a doubly linked list, where each node holds data and pointers to next and previous nodes, enabling insertion, deletion, and size operations in a Python context.
Insert a new node at the beginning of a double linked list by updating the head, next, and previous pointers, handling empty lists.
Traverse from the head to the end of the doubly linked list, insert the new node, update its and the last node's next and prev pointers, and handle empty list.
Learn how to insert a node at a given position in a doubly linked list, including beginning, end, and middle placements, updating next and previous pointers.
Implement deletion of the head node in a doubly linked list. Update the head pointer and the previous link accordingly.
Traverse from the head to the end of a doubly linked list, remove the last node by updating its previous node's next pointer, and handle empty lists.
Learn to delete a node at a given position in a doubly linked list by updating head and adjusting next and previous pointers to remove the target node.
Use a Python program to find the nth node from the end of a singly linked list by calculating the list length. Then advance to that node with targeted iterations.
Implement a two-pointer method to locate the nth node from the end of a singly linked list, using fast and slow pointers to reach the target efficiently.
Learn to detect a loop in a singly linked list by using two pointers, slow and fast, starting at the head, until they meet and implement a cycle-detection function.
Use two pointers to detect a cycle in a singly linked list, reach the meeting point, and count the loop length to determine the cycle size.
Explore how to locate the start node of a loop in a singly linked list using fast and slow pointers, resetting once a cycle is detected.
Learn to reverse a singly linked list using iteration by re-linking nodes to invert the list order.
Learn to reverse a singly linked list using recursion in Python, tracing reverse function calls and node pointers to produce the reversed list.
Identify the intersection point of two linked lists by hashing nodes from list one and checking nodes in list two for a shared address.
Learn a two-pointer approach to find the middle node of a singly linked list, returning the second pointer after the first reaches the list end.
Demonstrates displaying a singly linked list from tail to head, printing the last node first and then each preceding node to the head in reverse order.
Implement a python function to determine whether a singly linked list has an even or odd length by traversing from the head, using next pointers, and returning the parity.
learn to merge two independent singly linked lists in sorted order by building a third list, iterating and selecting the smaller head node from either list.
Learn to reverse a singly linked list in pairs by swapping data or links using an exchange function, and implement pairwise reversal.
Split a linked list into two halves using two pointers, advancing one to the middle while the other reaches the end, then disconnect to form two separate lists.
Implement a function to locate the last node in a singly linked list whose index is divisible by three by traversing from the head and updating the target.
Explain the logic of the function by detailing its reasoning, structure, and the underlying algorithmic steps that reveal how the solution works.
Learn to locate the fractional node in a singly linked list using a two-pointer approach, leveraging the list length and midpoint to identify and display the node data.
Explore how to explain the logic of a function in Python, within the context of solving interview questions on algorithms and data structures.
Engage in an exercise to explain the logic of the function, applying Python, algorithms, and data structures concepts to solve interview-style problems.
Explain the tree data structure with left and right nodes, show how left values are smaller and right values are larger, and cover insertion and searching operations.
Learn how to add nodes to a binary tree by comparing new data with the current node and placing smaller values on the left and larger values on the right.
Explore adding nodes to a binary tree by comparing data values and inserting on the left or right, creating new nodes as needed and returning control up the call stack.
Explore how to write a function to find a node in a binary tree, including left and right traversal and returning the found node.
Traverse a binary tree in inorder to display each node's data by visiting the left subtree, the node, then the right subtree, via a display function that recursively processes nodes.
Demonstrates a program that prints a binary tree in preorder format, visiting nodes and left and right subtrees to display each node’s data in sequence.
Explore a function that displays the contents of a binary tree in postorder by traversing left, right, and then printing node values.
Implement a function that checks whether a given tree is a binary tree by traversing all nodes and validating left and right conditions.
Learn how to implement level order traversal on a binary tree using a queue, visiting nodes level by level by enqueuing left and right children and collecting values.
Implement a function to find the maximum value in a binary tree by traversing from the root and comparing node values.
Learn to find the minimum value in a binary tree by traversing to the leftmost node and returning that value.
Traverse a binary tree using a queue to find the maximum value by comparing each node's data to a running max.
Implement a function to locate the node with the minimum value in a given binary tree, as part of your Python algorithms interview prep.
Iteratively locate a node with a given value in a binary tree using a queue-driven traversal. Perform a breadth-first search, checking node data and enqueuing children until found.
Learn how to compute the size of a binary tree using recursion, by visiting left and right subtrees and applying a base case to accumulate node counts.
Iteratively traverse the tree using a queue to visit every node and count the total number of nodes, printing the tree size.
Explore a program that prints a tree's contents in reverse order using iteration. It uses a queue to fetch node data, buffer elements, and output them in reverse.
Master how to compute the maximum depth of the tree and understand depth as the length to the deepest part.
In Python, use level-order iteration with a queue to locate the deepest node of a binary tree; the last popped node during traversal yields the deepest value.
Explore an iterative approach to counting leaves in a binary tree using a queue and a while loop, identifying nodes with no children and tallying them.
Count the number of full nodes in a binary tree with an iterative level-order traversal using a queue; increment the count when a node has both left and right children.
Count half nodes in a binary tree using an iterative level-order traversal with a queue, checking each node’s left or right child to tally half nodes.
Explore a program that uses a function to compare two binary trees. Assess how left and right determine similarity.
Learn how to compute the diameter of a binary tree, defined as the number of nodes on the longest path between leaves, using a recursive left-right subtree approach.
Learn to find the level with the maximum sum in a binary tree by traversing with a queue, computing each level's sum, and tracking the maximum level.
Develop a function to traverse a binary tree and collect the path to every node by visiting the left and right parts and appending each node to its path.
Refine the program that gets the combined numbers from root to leaf in a binary tree by analyzing the logic of two functions and clarifying what each does.
Identify a path in a binary tree whose nodes sum to a given value by exploring left and right subtrees.
Iteratively compute the sum of all nodes in a binary tree using a queue-based traversal, visiting left and right children and accumulating node data.
Learn how to implement a function that creates the mirror image of a binary tree by swapping the left and right subtrees in Python.
Explore how a specific function helps locate the parent of each node in a binary tree, as you complete an assignment to see what this function does.
Identify duplicated elements in a sorted array by iterating through the elements. Demonstrate the detection with an example like 3, 4, 5, 6, 7, 7 to show the duplicate seven.
Identify the element that appears the maximum number of times in an array by counting occurrences and tracking the maximum repetition across iterations.
Learn how to find the first non-repeated character in an array using a hash table or dictionary, counting occurrences and scanning to identify unique elements.
Identify and display duplicates in a Python array by marking visited indices with negative values and using absolute values to detect repeats.
Apply a hash table approach to count character frequencies in an array and identify the repeated character.
Learn to find the element that appears most often in an array by counting frequencies with a hash or dictionary in Python.
Use a hash table to detect the first repeated element in an array, employing a two-loop approach to track occurrences and identify the first duplicate efficiently.
Identify the missing number in a 1 to n sequence by comparing the array to the expected range and applying a step-by-step method.
Learn to identify the two elements that appear twice in an array by using a hash map to count occurrences and extract duplicates efficiently.
Learn to find two numbers in an array that sum to a target by using a hash table to track seen values and check complements while iterating.
Learn to select two numbers from an array whose sum is closest to zero by using a two-pointer approach, moving left and right indices and tracking the minimum absolute sum.
Apply a two-loop approach using left and right indices to find three numbers in an array that sum to a given value.
Develop a function to find the minimum element in a rotated array using low, high, and middle indices. Refine the approach by adjusting these indices to locate the minimum value.
Trace and explain a Python function that finds a given value in a rotated array, clarifying the program’s logic and how the algorithm locates the element.
Discover how to find the first occurrence of a number in an array using binary search, by maintaining low and high indices and pinpointing the earliest match.
Find the last occurrence of a number in an array using binary search, with mid-position calculations and iterative indexing to locate the correct element.
Identify the oddly repeated number in an array by implementing a function that loops through numbers and returns the repeated value.
Learn to separate even and odd numbers in an array using a two-pointer algorithm that swaps elements from left and right until evens come before odds.
Use a two-pointer approach to partition an array of zeros and ones by moving left and right indices toward each other, swapping misplaced elements until all zeros come before ones.
Master the dutch flag algorithm to separate zeroes, ones, and twos in an array through in-place swaps guided by index pointers.
Take on an assignment to implement a binary search using iteration in Python. Understand the program's mission and its biggest question within the context of algorithms and data structures.
Learn to compute the frequency of every number in an array using a hash table. Build a hash from each element, initializing counts and incrementing on repeats.
Learn to implement a function that uses a hash table to find the character that occurs only once in an array, by tracking frequencies and returning the non-repeated element.
Implement the bubble sort algorithm by iterating through elements, comparing pairs, and swapping out-of-order elements within the loop as the sort progresses.
Explore implementing selection sort by iterating through the list, selecting the minimum element in the unsorted portion, and swapping it into its correct position through guided iterations.
Master insertion sort algorithm by following outer and inner loops, tracking indices, and placing each value into its correct position through conditional checks.
learn how to implement the shell sort algorithm on arrays through guided iterations and inner and outer loops, including element movement, comparisons, and tracking positions to produce a sorted result.
Learn how to implement the merge sort algorithm in Python, focusing on dividing data into two parts, sorting each half, and producing a correct output.
Welcome to the course "Python: Solved Interview Questions on Algorithms and Data structures".
This course is from a software engineer who has managed to crack interviews in around 16 software companies.
Sometimes, life gives us no time to prepare, There are emergency times where in we have to buck up our guts and start bringing the situations under our control rather then being in the control of the situation. At the end of the day, All leave this earth empty handed. But given a situation, we should live up or fight up in such a way that the whole action sequence should make us proud and be giving us goosebumps when we think about it right after 10 years.
We would have observed the fact that though most of us are developers, only few would get a chance to work on certain advanced programming stuff like Data Structures, Linked Lists, Trees. The rest of us get to spend time in Bug fixing, resolving Maintenance issues during our work hours. Though this work doesn't help us much in improving our learning curve, it certainly feeds us and our families. So, Keeping this in mind, at the work place, We don't have any option but to work honestly.
But, the real trouble starts when we start attending interviews and suddenly somebody asks us to provide an optimal algorithm or a program which separates zeroes and ones in a array or somebody asks us to provide an efficient algorithm which will get the diameter of a tree. There can also occur a situation where in we think twice or get confused when we try to connect previous and next nodes while inserting a node between two nodes in a single or double link list.
Most of the times, the interviewer feels happy if we give him/her an optimal solution for a problem. It might so happen that, though we have around 8 to 10 years of software development experience, we still feel shaky and confused while literally tracing or debugging a recursive algorithm. The problem is though we know the solution, We will not be able to present it conveniently as we would have lost touch with the fundamentals of programming due to our day to day office routine, the work processes which are in place.
Speaking of this course, here we have tried to cover majority of interview questions on algorithms and data structures in python along with the basics of data structures. We have literally traced/debugged most of the algorithms for several interview questions. We have explained the solutions for several interview questions for the following content:
Stacks, Linked Lists, Trees, Arrays, Searching and Sorting.
The course content is around 9 hours. Kindly check the preview for 30 mins. If you are interested, Kindly take up the course. The respective programs are attached with the sessions. Kindly note that, We have focused more on explaining the optimal logic of the program rather then discussing the notations like Big O of the algorithms.
Kindly adjust the talking speed in accordance to your convenience (Please set the course narration speed on your convenience.). The concepts are presented in Neutral English.
The below are the interview questions explained in the course:
- write a program to implement stacks using lists
- write a program to implement stacks using linked lists
- write a program to balance symbols using stacks
- write a program to convert an infix expression to postfix expression
- write a program to evaluate a postfix expression
- write a program to find out whether a string is a palindrome using stacks
- write a program to reverse a given stack
- write a program to insert a node at the beginning of a single link list
- write a program to insert a node at the end of a single link list
- write a program to insert a node after a particular position in a single link list
- write a program to delete a node at the beginning of a single link list
- write a program to delete a node at the end of the single link list
- write a program to delete a node after a particular position in a single link list
- write a program to search a node in a single link list
- write a program to get the size of a single link list
- write a program to insert a node at the beginning of a double link list
- write a program to insert a node at the end of a double link list
- write a program to insert a node after a particular position in a double link list
- write a program to delete a node at the beginning of a double link list
- write a program to delete a node at the end of the double link list
- write a program to delete a node after a particular position in a double link list
- write a program to find the nth node from the end of the single link list
- write a program which suggests an alternative way to find the nth node from the end of the single link list
- write a program which detects a loop in a single link list
- write a program which finds the length of the loop in a single link list
- write a program which finds the start node of a loop in a single link list
- write a program which reverses the single link list using iteration
- write a program which reverses the single link list using recursion
- write a program which get's us the intersection point of two independent single link lists which are fused at one point
- write a program which finds the middle node of a single link list
- write a program which display the single link list contents beginning from the tail of the list
- write a program which checks if the single link list is even or odd in length
- write a program which merges two independent single linked lists in sorted order
- write a program which reverses the nodes in pairs in a single link list
- write a program which finds the modular node from the end of the single link list
- write a program which finds the modular node from the beginning of the single link list
- write a program which gets the fractional node in a single link list
- write a program which removes the duplicate nodes from a single link list
- write a program which gets the square root node in a single link list
- write a program to add nodes in a binary tree
- write program to find a node in a binary tree
- write a program which displays the contents of a binary tree in an inorder format
- write a program which displays the contents of a binary tree in an preorder format
- write a program which displays the contents of a binary tree in an postorder format
- write a program which checks whether a given tree is a binary tree
- write a program which performs level order traversal on a given binary tree
- write a program which finds the node which has got the maximum value in a given binary tree
- write a program which finds the node which has got the manimum value in a given binary tree
- write a program which finds the node which has got the maximum value using level order traversal in a given binary tree
- write a program which finds the node which has got the minimum value using level order traversal in a given binary tree
- write a program which find the node with a given value using iteration
- write a program which finds the size of the given binary tree using iteration
- write a program which prints the contents of the tree in reverse order using iteration
- write a program which gets the maximum depth of the tree
- write a program which find the deepest node of the tree using iteration
- write a program which counts the number of leaves in the tree using iteration
- write a program which counts the number of full nodes in a tree using iteration
- write a program which counts the number of half nodes in a tree using iteration
- write a program which compares two binary trees
- write a program which find the diameter of a given binary tree
- write a program which gets the level with the maximum sum in a given binary tree
- write a program which gets the path of all nodes in a binary tree
- write a program which gets the combined numbers from root to leaf in a binary tree
- write a program which gets the path which has a given sum in a given binary tree
- write a program which gets the sum of all nodes in a binary tree
- write a program which creates the mirror image of the given binary tree
- write a program which check if two binary trees are mirror images of each other
- write a program which gets the parent of the nodes in a binary tree
- write a program to find duplicated elements in a sorted array
- write a program to find the element which appears maximum number of times in an array
- write a program which gets the non repeated character in the array
- write a program which displays the duplicated numbers in the array
- write a program which gets the repeated character in the array
- write a program which gets the element which has appeared maximum number of times in a array using hashing
- write a program which gets the first repeated element in the array using hashing
- write a program which finds the missing number in a array
- write a program which gets two elements which are present twice in an array using hashing
- write a program which from an array gets the two numbers which form a sum
- write a program which from an array gets the two numbers when combined is close to zero
- write a program which from an array gets the three numbers which form a sum
- write a program which from a rotated array, gets the element which has got a minimum value
- write a program which from a rotated array, finds the element with a given value
- write a program which gets the first occurence of a number using binary search in an array
- write a program which gets the last occurence of a number using binary search in an array
- write a program which gets the oddly repeated number in a array
- write a program which seperate even and odd numbers in a array
- write a program which seperate zeroes and ones in the array
- write a programs which seperate zeroes, ones and twos in the array using dutchflag algorithm
- write a program to perform binary search using iteration
- write a program to perform binary search using recursion
- write a program to get the frequency of every number in a array
- write a program which will get the character which has occured only once in the array
- write a program to get the element forming sum from 2 sorted arrays
- write a program to implement bubble sort algorithm
- write a program to implement selection sort algorithm
- write a program to implement shell sort algorithm
- write a program to implement insertion sort algorithm