Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SLL sortiraj_opagacki() {
- // Vasiot kod tuka
- if (first == null){
- System.out.print("nema");
- return this;
- }
- boolean flag = true;
- while(flag){
- flag = false;
- SLLNode d1 = first;
- SLLNode d2 = first;
- SLLNode pom;
- while (d1.succ!=null)
- if (d1.id < d1.succ.id){
- flag = true;
- pom = d1.succ;
- d1.succ = pom.succ;
- pom.succ = d1;
- if (d1 == first) d2 = first = pom;
- else d2 = d2.succ = pom;
- } else {
- if (d1!=first) d2 = d2.succ;
- d1 = d1.succ;
- }
- }
- return this;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement