MY PRIVATE ARCADY
  • Home
  • Archives
  • Categories
  • Tags
  • About
  • Links
  •   
  •   

Sort Algorithm - Selection Sort

Definition:Selection sort is a simple comparison-based sorting algorithm that repeatedly selects the minimum element from the unsorted part of the array and places it at the beginning. It works by div
2023-09-04
CS > Data Structures
#CS #Data Structures #Java

Sort Algorithm - Bubble Sort

Definition:Bubble sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares adjacent elements, and swaps them if they are in the wrong order. It continues these
2023-09-04
CS > Data Structures
#CS #Data Structures #Java

The Eight Queen Problem

ProblemThe Eight Queens Problem is a classic chess puzzle that involves placing eight queens on a chessboard in such a way that no two queens threaten each other. This means that no two queens can sha
2023-09-03
CS > Data Structures
#CS #Data Structures #Java

Use recursive backtracking to solve rat in a maze problem

Problem and backgroundGiven a maze[][] of n * m matrix, a rat has to find a path from source to destination. Use a recursive method to find the exit route of the maze. Backtracking is a versatile alg
2023-09-01
CS > Data Structures
#CS #Data Structures #Java

Use RPN(Reverse Polish Notation) to implement calculator

RPN(Reverse Polish Notation): Operators follow their operands, in contrast to PN(Polish Notation). 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
2023-01-25
CS > Data Structures
#CS #Data Structures #Java

Use stack to implement a calculator

使用栈完成表达式的计算思路: 通过一个 index 值(索引),来遍历表达式 如果我们发现是一个数字, 就直接入数栈 如果发现扫描到是一个符号, 就分如下情况 3.1 如果发现当前的符号栈为 空,就直接入栈 3.2 如果符号栈有操作符,就进行比较, ​ 如果当前的操作符的优先级小于或者等于栈中的操作符, 就需要从数栈中pop出两个数,在从符号栈中pop出一个符号,进行运算,将得到
2023-01-25
CS > Data Structures
#CS #Data Structures #Java

Use arrays to implement stack

栈:先入后出(FILO-First In Last Out)的有序链表。top–bottom, pop–push。 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//use arrays to implement stackclass ArraySta
2023-01-14
CS > Data Structures
#CS #Data Structures #Java

Use circular linked list to solve Josephus problem

[cited from wikipedia]Josephus Problem: A number of people are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a speci
2023-01-11
CS > Data Structures
#CS #Data Structures #Java

Singly Linked List

单向链表——data+next,只能从头向后遍历,头节点(head node)不存储信息。 定义结点(node)123456789101112131415161718class HeroNode { public int no; public String name; public String nickName; public HeroNode next;
2023-01-09
CS > Data Structures
#CS #Data Structures #Java

Using arrays to implement queues (JAVA)

队列(Queue):有序列表,可以用数组或链表实现。先入先出。 数组模拟普通队列front: point to the previous place of the first element. rear: point to the last element. 1234567891011121314151617181920212223242526272829303132333435363738394
2022-12-28
CS > Data Structures
#CS #Data Structures #Java
123

Search

Hexo Fluid