Tags » Linked List

HashMap in Java8 - there are performance improvements!

Hello all. There are some performance improvements for HashMap in Java8.

But it is significant only when we are dealing with collisions in the keys. That means if we have too many unequal keys that happens to have same hashcode or they hash to same bucket. 270 more words

Technology

Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

http://articles.leetcode.com/2010/11/convert-sorted-list-to-balanced-binary.html

Thoughts: use in order and construct binary search tree recursively… 99 more words

K Largest Elements From an Infinite Stream

Problem: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order. For example, if given array is and you are asked for the largest 3 elements i.e., k = 3 then your program should print 51, 32 and 20. 262 more words

Arrays

Reverse a Doubly Linked List

/*
Reverse a doubly linked list, input list may also be empty
Node is defined as
struct Node
{
int data;
Node *next;
Node *prev; 41 more words

Linked List

Appending Node In Linked List

/*
Insert Node at the end of a linked list
head pointer input could be NULL as well for empty list
Node is defined as… 68 more words

Linked List

Delete Node at Given Position in Linked List

/*
Delete Node at a given position in a linked list.
Position start from 0, means position for head pointing node is 0.
Node is defined as… 84 more words

Linked List

Finding Merging Point of Two Linked List

/*
Find merge point of two linked lists
Node is defined as
struct Node
{
int data;
Node* next;
}
*/


int FindMergeNode(Node *headA, Node *headB)
{
	// Complete this function
	// Do not write the main method. 33 more words
Linked List