Write a function that takes a singly linked list and returns a complete copy of that list.
We have discussed about the linked list data structure which is dynamic in nature (the memory is allocated during the run time). Now the question that might be on a few peoples minds is – can a linked link be implemented statically as well? This post tries to answer this question.
In the previous two posts (here and here), we have introduced linked list data structure and discussed about various types of linked lists.. We also covered in great detail the various methods to construct a linked list which inserts every new node onto the front of the list. In this post, we will discuss various …
In previous post, we have introduced linked list data structure and discussed about various types of linked lists. We have also covered the applications of linked list data structure and its pros and cons with respect to arrays. In this post, we will discuss various Linked List implementation techniques in detail and construct a singly …
A linked list is a linear data structure consisting of a group of nodes where each node point to the next node by means of a pointer. Each node is composed of data and a reference (in other words, a link) to the next node in the sequence.
Word Break Problem: Given a string and a dictionary of words, determine if string can be segmented into a space-separated sequence of one or more dictionary words.
Find optimal cost to construct binary search tree where each key can repeat several times. We are given frequency of each key in same order as corresponding keys in inorder traversal of a binary search tree.
Given a M x N matrix where each cell can have value of 1, 0 or -1, where -1 denotes a unsafe cell, collect maximum number of ones starting from first cell and by visiting only safe cells (i.e. 0 or 1). We are allowed to go only left or down if the row is …
Given a pattern, count number of times the pattern appears in the given string as a subsequence.
Longest Alternating Subsequence is a problem of finding a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible.
Given an unlimited supply of coins of given denominations, find the total number of distinct ways to get a desired change.
Given an unlimited supply of coins of given denominations, find the minimum number of coins required to get a desired change.