Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /**
  2. * Definition for singly-linked list.
  3. * public class ListNode {
  4. * int val;
  5. * ListNode next;
  6. * ListNode(int x) { val = x; }
  7. * }
  8. */
  9. class Solution {
  10. public ListNode sortList(ListNode head) {
  11. int stepSize = 2;
  12. ListNode temp = new Node(0);
  13. temp.next =
  14. while(true) {
  15. ListNode curr = head;
  16. while(curr->next != null) {
  17. ListNode curr2 = curr;
  18. for(int i=0; i<stepSize; i++) curr2 = curr2.next;
  19. int currStep = 0, curr2Step = 0;
  20. for(int i=0; i<stepSize; i++) {
  21. if(curr.val < curr2.val) {
  22. if(i==0) {
  23. newHead = curr;
  24. } else {
  25.  
  26. }
  27. }
  28. }
  29. }
  30. }
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement