123
This commit is contained in:
commit
9a162c4a10
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
### IntelliJ IDEA ###
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/AiSD_lab1.iml" filepath="$PROJECT_DIR$/AiSD_lab1.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
11
AiSD_lab1.iml
Normal file
11
AiSD_lab1.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
0
src/InsertionSort.java
Normal file
0
src/InsertionSort.java
Normal file
47
src/Main.java
Normal file
47
src/Main.java
Normal file
@ -0,0 +1,47 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
// Scanner b = new Scanner(System.in);
|
||||
// QueueOnLinkedlist a = new QueueOnLinkedlist();
|
||||
// for (int i = 0; i < 5; i++) {
|
||||
// a.add(b.nextLine());
|
||||
// }
|
||||
//
|
||||
// System.out.println(a.peek());
|
||||
|
||||
int[] arr = new int[10];
|
||||
for (int i = 9; i >= 0; i--){
|
||||
arr[9 - i] = i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int n = arr.length;
|
||||
for (int i = 1; i < n; ++i) {
|
||||
int key = arr[i];
|
||||
int j = i - 1;
|
||||
|
||||
|
||||
while (j >= 0 && arr[j] > key) {
|
||||
arr[j + 1] = arr[j];
|
||||
j = j - 1;
|
||||
}
|
||||
arr[j + 1] = key;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < arr.length; i++){
|
||||
System.out.print(arr[i] + " ");
|
||||
}
|
||||
}
|
||||
}
|
19
src/Node.java
Normal file
19
src/Node.java
Normal file
@ -0,0 +1,19 @@
|
||||
public class Node <T>{
|
||||
private T value;
|
||||
private Node <T> next;
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Node<T> getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
public void setNext(Node<T> next) {
|
||||
this.next = next;
|
||||
}
|
||||
}
|
20
src/QueueOnLinkedlist.java
Normal file
20
src/QueueOnLinkedlist.java
Normal file
@ -0,0 +1,20 @@
|
||||
import java.util.LinkedList;
|
||||
public class QueueOnLinkedlist {
|
||||
|
||||
private LinkedList<String> queuee = new LinkedList<>();
|
||||
|
||||
public void add (String s){
|
||||
queuee.add(s);
|
||||
}
|
||||
public String peek (){
|
||||
return queuee.peekFirst();
|
||||
}
|
||||
public void pop (){
|
||||
queuee.removeFirst();
|
||||
}
|
||||
public void printQueue(){
|
||||
for (String element : queuee) {
|
||||
System.out.println(element);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user