본문 바로가기

Programming/Data Structure25

[Hackerrank] contacts - Map, List (HashMap, ArrayList) https://www.hackerrank.com/challenges/contacts/problem Contacts | HackerRank Create a Contacts application with the two basic operations: add and find. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/contacts/problem import java.util.*; public class Contacts { public static void main(String[] args) { System.out.println(Arrays.toString(contacts(new String[][]{{"a.. 2020. 12. 6.
[Hackerrank] BinarySearchTreeInsertion https://www.hackerrank.com/challenges/binary-search-tree-insertion/problem Binary Search Tree : Insertion | HackerRank Given a number, insert it into it's position in a binary search tree. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/binary-search-tree-insertion/problem import exam.Node; public class BinarySearchTreeInsertion { public static void main(String[.. 2020. 12. 6.
[Hackerrank] TreePreorderTraversal www.hackerrank.com/challenges/tree-preorder-traversal/problem Tree: Preorder Traversal | HackerRank Print the preorder traversal of a binary tree. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/tree-preorder-traversal/problem import exam.Node; public class TreePreorderTraversal { public static void main(String[] args) { Node node4 = new Node(4); Node node3 = ne.. 2020. 12. 2.
[Hackerrank] TreePostorderTraversal www.hackerrank.com/challenges/tree-postorder-traversal/problem Tree: Postorder Traversal | HackerRank Print the post order traversal of a binary tree. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/tree-postorder-traversal/problem import exam.Node; public class TreePostorderTraversal { public static void main(String[] args) { Node node4 = new Node(4); Node node.. 2020. 12. 2.
[Hackerrank] TreeInorderTraversal www.hackerrank.com/challenges/tree-inorder-traversal/problemTree: Inorder Traversal | HackerRankPrint the inorder traversal of a binary tree.www.hackerrank.compackage exam.complete; //https://www.hackerrank.com/challenges/tree-inorder-traversal/problem import exam.Node; public class TreeInorderTraversal { public static void main(String[] args) { Node node4 = new Node(4); Node node3 = new Node(3,.. 2020. 12. 2.
[Hackerrank] TreeHeightofaBinaryTree www.hackerrank.com/challenges/tree-height-of-a-binary-tree/problem Tree: Height of a Binary Tree | HackerRank Given a binary tree, print its height. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree/problem import exam.Node; public class TreeHeightofaBinaryTree { public static void main(String[] args) { Node node4 = new Node(4); Node n.. 2020. 12. 2.
[Hackerrank] SortedInsert www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list/problem Inserting a Node Into a Sorted Doubly Linked List | HackerRank Create a node with a given value and insert it into a sorted doubly-linked list www.hackerrank.com package exam.complete; import exam.DoublyLinkedListNode; //https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list/problem.. 2020. 12. 2.
[Hackerrank] ReversePrint https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-in-reverse/problem Print in Reverse | HackerRank Print the elements of a linked list in reverse order, from tail to head www.hackerrank.com package exam.complete; import exam.SinglyLinkedListNode; import java.util.ArrayList; import java.util.List; //https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-.. 2020. 12. 2.
[Hackerrank] Reversealinkedlist www.hackerrank.com/challenges/reverse-a-linked-list/problem Reverse a linked list | HackerRank Change the links between the nodes of a linked list to reverse it www.hackerrank.com package exam.complete; import exam.SinglyLinkedListNode; //https://www.hackerrank.com/challenges/reverse-a-linked-list/problem public class Reversealinkedlist { public static void main(String[] args) { SinglyLinkedList.. 2020. 12. 2.