A stack is a linear data structure that maintains the order in which elements are added. It only has one point to add and remove data.
-
-
From Wikipedia: A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system). Segmentation is one approach to memory management and protection in the operating system. It has been superseded by paging for most purposes, but much of the terminology of segmentation is still used, “segmentation fault” being an example. …
-
Linked List
Find the merging point of 2 Linked Lists. Popularly called the Y-node problem.
by nikoo2810 minutes readQuestion: You are given the head pointer to 2 single Linked Lists, and both of the lists converge at a certain point and then advance forward. We need to find the address of the node, at which both of the Linked Lists meet. Input: 4 -> 8 -> 15 -> 42 -> 99 16 -> 23 -> Output: 42 Suppose there are two single Linked Lists both of which intersect at some point and become a single Linked list. The head or start pointer of both the lists …
-
This is one of the method, not everyone is aware of in C. To generate a random number, C itself provides us a method srand(). We can use it in this way. NOTE: The function srand(time(NULL)) can only be called once in the program.
-
Many of us must have heard of the clause “Real Programmers code in C” and it is faster than any other language because “it is close to the machine“. What is so special about this language that makes it different from any other language. Let us try to explore this answer to some extent. There isn’t much that’s special about C. That’s one of the reasons why it’s fast. Newer languages which have support for garbage collection, dynamic typing and other facilities which make it easier for the programmer to …
-
Copying an entire Linked List, means allocating new memory and copying all the data to the new location. This requires traversing each node and copying its data to a new location, keeping the original data intact.
-
Question: Write a program to check if the given Linked List is a palindrome or not? Input: 1.> 4, 8, 15, 16, 23, 42 2.> 4, 8, 15, 16, 15, 8, 4 Output: 1.> IS NOT A PALINDROME 2.> IS A PALINDROME What is a Palindrome? According to Wikipedia, A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction. Thus, numbers like 121, 1331, 98711789 are palindromes. Similarly, Linked Lists can be …
