Skip to content

Commit b692b1d

Browse files
committed
add recusrive sorts
1 parent b416f7c commit b692b1d

18 files changed

Lines changed: 430 additions & 241 deletions

File tree

β€Ž.githooks/pre-commitβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
repo_root="$(git rev-parse --show-toplevel)"
5+
"$repo_root/scripts/update-readme.sh"
6+
git add "$repo_root/README.md"

β€ŽAlgorithm Solutions In Swift.xcodeproj/project.pbxprojβ€Ž

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
1F7037632F3E5642002CFFE1 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 1F7037622F3E5642002CFFE1 /* OrderedCollections */; };
1919
1F7037652F3E5642002CFFE1 /* TrailingElementsModule in Frameworks */ = {isa = PBXBuildFile; productRef = 1F7037642F3E5642002CFFE1 /* TrailingElementsModule */; };
2020
1F7037672F3E5642002CFFE1 /* _RopeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 1F7037662F3E5642002CFFE1 /* _RopeModule */; };
21+
1F85E42E2F500D0F0097933E /* RecursiveBubbleSort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F85E42D2F500D060097933E /* RecursiveBubbleSort.swift */; };
22+
1F85E4312F500D2A0097933E /* RecusriveInsertionSort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F85E4302F500D210097933E /* RecusriveInsertionSort.swift */; };
2123
6A09C87827EA646600BB9A38 /* MinRewards.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A09C87727EA646600BB9A38 /* MinRewards.swift */; };
2224
6A09C87B27EA690200BB9A38 /* BuySellStock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A09C87A27EA690200BB9A38 /* BuySellStock.swift */; };
2325
6A09C87C27EA690200BB9A38 /* BuySellStock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A09C87A27EA690200BB9A38 /* BuySellStock.swift */; };
@@ -328,6 +330,8 @@
328330
/* End PBXCopyFilesBuildPhase section */
329331

330332
/* Begin PBXFileReference section */
333+
1F85E42D2F500D060097933E /* RecursiveBubbleSort.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecursiveBubbleSort.swift; sourceTree = "<group>"; };
334+
1F85E4302F500D210097933E /* RecusriveInsertionSort.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecusriveInsertionSort.swift; sourceTree = "<group>"; };
331335
6A09C87727EA646600BB9A38 /* MinRewards.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinRewards.swift; sourceTree = "<group>"; };
332336
6A09C87A27EA690200BB9A38 /* BuySellStock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuySellStock.swift; sourceTree = "<group>"; };
333337
6A09C87F27EBA43800BB9A38 /* SmallestSubstringAllCharacters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmallestSubstringAllCharacters.swift; sourceTree = "<group>"; };
@@ -463,20 +467,10 @@
463467
6AA826BE2808A5F700F79CDF /* ValidIPAddresses.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidIPAddresses.swift; sourceTree = "<group>"; };
464468
6AA826D6280DF47D00F79CDF /* UniqueEmailAddress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniqueEmailAddress.swift; sourceTree = "<group>"; };
465469
6AA826D9280E0AAB00F79CDF /* LicenseKeyFormatting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseKeyFormatting.swift; sourceTree = "<group>"; };
466-
6AA826DD280ECFB600F79CDF /* QuickSort.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = QuickSort.md; sourceTree = "<group>"; };
467-
6AA826DE28100EB800F79CDF /* MergeSort.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = MergeSort.md; sourceTree = "<group>"; };
468470
6AA826E02810159200F79CDF /* Permutations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permutations.swift; sourceTree = "<group>"; };
469-
6AA826E228101B5300F79CDF /* Permutations.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Permutations.md; sourceTree = "<group>"; };
470-
6AA826E328101B5F00F79CDF /* ValidIPAddresses.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = ValidIPAddresses.md; sourceTree = "<group>"; };
471471
6AA826E528108BCD00F79CDF /* ContainerWithMostWater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerWithMostWater.swift; sourceTree = "<group>"; };
472-
6AA826E928114D5A00F79CDF /* PowerSet.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = PowerSet.md; sourceTree = "<group>"; };
473-
6AA826EA28114D8700F79CDF /* InsertionSort.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = InsertionSort.md; sourceTree = "<group>"; };
474-
6AA826EB28114D9C00F79CDF /* SelectionSort.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = SelectionSort.md; sourceTree = "<group>"; };
475-
6AA826EC28114DAD00F79CDF /* BubbleSort.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = BubbleSort.md; sourceTree = "<group>"; };
476472
6AA826EE28114F4500F79CDF /* PowerSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PowerSet.swift; sourceTree = "<group>"; };
477-
6AA826F028128DA500F79CDF /* Search2DMatrix.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Search2DMatrix.md; sourceTree = "<group>"; };
478473
6AA826F228128DC800F79CDF /* Search2DMatrix.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Search2DMatrix.swift; sourceTree = "<group>"; };
479-
6AA826F428129ED100F79CDF /* LongestSubstringWithoutDuplication.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LongestSubstringWithoutDuplication.md; sourceTree = "<group>"; };
480474
6AA826F628129F0900F79CDF /* LongestSubstringWithoutDuplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongestSubstringWithoutDuplication.swift; sourceTree = "<group>"; };
481475
6AAC7BE92800461F00ADB33F /* CalenderMatching.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalenderMatching.swift; sourceTree = "<group>"; };
482476
6AAC7BEC2803543E00ADB33F /* LargestIntergerByParity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargestIntergerByParity.swift; sourceTree = "<group>"; };
@@ -600,6 +594,22 @@
600594
/* End PBXFrameworksBuildPhase section */
601595

602596
/* Begin PBXGroup section */
597+
1F85E42C2F500D010097933E /* Recursive Bubble Sort */ = {
598+
isa = PBXGroup;
599+
children = (
600+
1F85E42D2F500D060097933E /* RecursiveBubbleSort.swift */,
601+
);
602+
path = "Recursive Bubble Sort";
603+
sourceTree = "<group>";
604+
};
605+
1F85E42F2F500D1D0097933E /* Recursive Insertion Sort */ = {
606+
isa = PBXGroup;
607+
children = (
608+
1F85E4302F500D210097933E /* RecusriveInsertionSort.swift */,
609+
);
610+
path = "Recursive Insertion Sort";
611+
sourceTree = "<group>";
612+
};
603613
6A09C87627EA645400BB9A38 /* Min Rewards */ = {
604614
isa = PBXGroup;
605615
children = (
@@ -1215,6 +1225,7 @@
12151225
6A88CEE526C056A400A3746B /* LeetCode */ = {
12161226
isa = PBXGroup;
12171227
children = (
1228+
1F85E42C2F500D010097933E /* Recursive Bubble Sort */,
12181229
6A6C59C92C4D78C9004309F7 /* Build a Matrix With Conditions */,
12191230
6A6C59C62C4D786F004309F7 /* Topological Sort */,
12201231
6AD56D732C4196C200E06EE0 /* Maximum Score From Removing Substrings */,
@@ -1316,6 +1327,7 @@
13161327
6ABE6FC626FC635500C6E524 /* Divide Two Integers */,
13171328
6A88CEEA26C3132700A3746B /* Merge Intervals */,
13181329
6A88CEE626C056BD00A3746B /* 3 Sum Closest */,
1330+
1F85E42F2F500D1D0097933E /* Recursive Insertion Sort */,
13191331
);
13201332
path = LeetCode;
13211333
sourceTree = "<group>";
@@ -1784,23 +1796,6 @@
17841796
path = "License Key Formatting";
17851797
sourceTree = "<group>";
17861798
};
1787-
6AA826DB280EB90300F79CDF /* Concepts */ = {
1788-
isa = PBXGroup;
1789-
children = (
1790-
6AA826DD280ECFB600F79CDF /* QuickSort.md */,
1791-
6AA826DE28100EB800F79CDF /* MergeSort.md */,
1792-
6AA826E228101B5300F79CDF /* Permutations.md */,
1793-
6AA826E328101B5F00F79CDF /* ValidIPAddresses.md */,
1794-
6AA826E928114D5A00F79CDF /* PowerSet.md */,
1795-
6AA826EA28114D8700F79CDF /* InsertionSort.md */,
1796-
6AA826EB28114D9C00F79CDF /* SelectionSort.md */,
1797-
6AA826EC28114DAD00F79CDF /* BubbleSort.md */,
1798-
6AA826F028128DA500F79CDF /* Search2DMatrix.md */,
1799-
6AA826F428129ED100F79CDF /* LongestSubstringWithoutDuplication.md */,
1800-
);
1801-
path = Concepts;
1802-
sourceTree = "<group>";
1803-
};
18041799
6AA826DF2810154E00F79CDF /* Permutations */ = {
18051800
isa = PBXGroup;
18061801
children = (
@@ -2053,7 +2048,6 @@
20532048
isa = PBXGroup;
20542049
children = (
20552050
6AF5787B26A2E60E007B37CA /* Algorithm Solutions In Swift */,
2056-
6AA826DB280EB90300F79CDF /* Concepts */,
20572051
6A09C87D27EBA40900BB9A38 /* Pramp */,
20582052
6A9927EF27EA4AC700848E23 /* GeekForGeeks */,
20592053
6A88CEE526C056A400A3746B /* LeetCode */,
@@ -2780,6 +2774,7 @@
27802774
6A4364AE27F4E9B300F09D92 /* BalancedBrackets.swift in Sources */,
27812775
6AF5789B26A2E73A007B37CA /* NodeDpeths.swift in Sources */,
27822776
6A09C88A27F03DF400BB9A38 /* Solution.swift in Sources */,
2777+
1F85E42E2F500D0F0097933E /* RecursiveBubbleSort.swift in Sources */,
27832778
6A651A3129070B51000731BB /* StringsMultiply.swift in Sources */,
27842779
6A651A6629078B5E000731BB /* MaximumDepthBinaryTree.swift in Sources */,
27852780
6A88CF1026C995F700A3746B /* MergeListLists.swift in Sources */,
@@ -2860,6 +2855,7 @@
28602855
6A5022FC2856F5E900688107 /* LRUCache.swift in Sources */,
28612856
6AF578AD26A2E7F0007B37CA /* NthFibonacci.swift in Sources */,
28622857
6AE51D3926B3C20500102A7C /* MergeOverlappingIntervals.swift in Sources */,
2858+
1F85E4312F500D2A0097933E /* RecusriveInsertionSort.swift in Sources */,
28632859
6AF5789826A2E728007B37CA /* BranchSums.swift in Sources */,
28642860
6AF24B322883DEAD00077B49 /* NumberOfWaysToTraverseGraph.swift in Sources */,
28652861
6AF5791526A74CC6007B37CA /* CountPairs.swift in Sources */,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
21
import Foundation
32

4-
print("hello")
3+
4+
//func insertionSort(array: inout [Int]) -> [Int] {
5+
// for idx in 1..<array.count {
6+
// var sortedIdx = idx - 1
7+
// let key = array[idx]
8+
// while sortedIdx >= 0, key < array[sortedIdx] {
9+
// array[sortedIdx + 1] = array[sortedIdx]
10+
// sortedIdx -= 1
11+
// }
12+
// array[sortedIdx + 1] = key
13+
// }
14+
// return array
15+
//}
16+
17+
18+
19+
var array = [5, 3, 1, 7, 2]
20+
recursiveInsertionSort(&array)
21+
print(array)

β€ŽConcepts/BubbleSort.mdβ€Ž

Lines changed: 0 additions & 2 deletions
This file was deleted.

β€ŽConcepts/InsertionSort.mdβ€Ž

Lines changed: 0 additions & 2 deletions
This file was deleted.

β€ŽConcepts/LongestSubstringWithoutDuplication.mdβ€Ž

Lines changed: 0 additions & 2 deletions
This file was deleted.

β€ŽConcepts/MergeSort.mdβ€Ž

Lines changed: 0 additions & 18 deletions
This file was deleted.

β€ŽConcepts/Permutations.mdβ€Ž

Lines changed: 0 additions & 2 deletions
This file was deleted.

β€ŽConcepts/PowerSet.mdβ€Ž

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
Β (0)