bogotech

Helping engineers with technical interviews

Linked lists vs Arrays: Comparing Advantages, Disadvantages, and Trade-Offs

Data structures are an essential part of computer science, and they play a critical role in designing efficient algorithms. Two of the most commonly used data structures are arrays and linked lists. While both of these data structures are used to store and manipulate collections of data, they differ in their implementation and functionality. In […]

Read More
Learn linkedlist implementation in ruby

Ruby LinkedList Class Tutorial: Implementation and Usage

Ruby has a built-in linked list class called LinkedList, which is part of the enumerator package. The LinkedList class is a linear data structure that consists of a sequence of nodes, where each node contains a data element and a reference to the next node in the list. Here is an example code to create […]

Read More
Linked list interview question

Remove duplicates from a sorted linked list.

Given a sorted linked list, write a function to remove all the duplicate elements from the list, such that each element appears only once. Example: Input: 1 -> 1 -> 2 Output: 1 -> 2 Input: 1 -> 1 -> 2 -> 3 -> 3 Output: 1 -> 2 -> 3 Solution: One approach to […]

Read More
Learn linkedlist implementation in ruby

Linked list implementation and operations in Ruby

In Ruby, a linked list is a data structure that consists of a sequence of nodes. Each node in the list contains a data element and a reference (or pointer) to the next node in the sequence. The first node is called the head of the list, and the last node is called the tail […]

Read More

Introduction to skip list: An advanced LinkedList

Skip lists are a probabilistic data structure that uses multiple levels of linked lists to provide efficient search and insertion operations. Each node in a skip list has multiple forward pointers, allowing for efficient traversal of nodes that are farther away from the current node. Skip lists are designed to improve the efficiency of search […]

Read More

Java LinkedList Class Implementation Guide and Examples

LinkedList is a linear data structure that is used to store a collection of elements. It is a sequence of nodes, where each node contains an element and a reference to the next node in the sequence. The first node in the sequence is called the head of the list, while the last node is […]

Read More
Linked list interview question

Sort a linked list using shared pointer

Linked lists are commonly used data structures in computer programming. Linked lists consist of nodes that are dynamically allocated, meaning that memory must be manually managed. Memory management can be a complex and error-prone task, and to make it easier, shared pointers are used in linked list implementation. Shared pointers are smart pointers that help […]

Read More
Linked list interview question

Swapping nodes in a linked list

Swapping nodes in a linked list means exchanging the positions of two nodes in the list. For example, if we have a linked list 1 -> 2 -> 3 -> 4 -> 5 and we want to swap the second and fourth nodes, the result will be 1 -> 4 -> 3 -> 2 -> […]

Read More

Implement doubly linked list using shared ptr

A shared pointer is a smart pointer that can manage the lifetime of an object by keeping track of how many pointers are pointing to it. In a doubly linked list, a shared pointer can be used to manage the memory of the nodes. In a doubly linked list, each node has two pointers: a […]

Read More
Linked list interview question

Write a program to find the number of days between two dates

Using datetime library in your choice of language makes it easy to write a program to find the number of days between two dates. We write code with and without using the library. Let’s first find the number of days between two dates with using a library: 1. Prompt the user to enter the first […]

Read More

Page 2 of 4

Powered by WordPress & Theme by Anders Norén