Last active
March 25, 2024 03:02
-
-
Save roryokane/6f9061d3a60c1ba41237 to your computer and use it in GitHub Desktop.
Comparison between Git diff algorithms: myers (default) vs. patience (example favors patience)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/file.c b/file.c | |
index 6faa5a3..e3af329 100644 | |
--- a/file.c | |
+++ b/file.c | |
@@ -1,26 +1,25 @@ | |
#include <stdio.h> | |
-// Frobs foo heartily | |
-int frobnitz(int foo) | |
+int fib(int n) | |
{ | |
- int i; | |
- for(i = 0; i < 10; i++) | |
+ if(n > 2) | |
{ | |
- printf("Your answer is: "); | |
- printf("%d\n", foo); | |
+ return fib(n-1) + fib(n-2); | |
} | |
+ return 1; | |
} | |
-int fact(int n) | |
+// Frobs foo heartily | |
+int frobnitz(int foo) | |
{ | |
- if(n > 1) | |
+ int i; | |
+ for(i = 0; i < 10; i++) | |
{ | |
- return fact(n-1) * n; | |
+ printf("%d\n", foo); | |
} | |
- return 1; | |
} | |
int main(int argc, char **argv) | |
{ | |
- frobnitz(fact(10)); | |
+ frobnitz(fib(10)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/file.c b/file.c | |
index 6faa5a3..e3af329 100644 | |
--- a/file.c | |
+++ b/file.c | |
@@ -1,26 +1,25 @@ | |
#include <stdio.h> | |
+int fib(int n) | |
+{ | |
+ if(n > 2) | |
+ { | |
+ return fib(n-1) + fib(n-2); | |
+ } | |
+ return 1; | |
+} | |
+ | |
// Frobs foo heartily | |
int frobnitz(int foo) | |
{ | |
int i; | |
for(i = 0; i < 10; i++) | |
{ | |
- printf("Your answer is: "); | |
printf("%d\n", foo); | |
} | |
} | |
-int fact(int n) | |
-{ | |
- if(n > 1) | |
- { | |
- return fact(n-1) * n; | |
- } | |
- return 1; | |
-} | |
- | |
int main(int argc, char **argv) | |
{ | |
- frobnitz(fact(10)); | |
+ frobnitz(fib(10)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// Frobs foo heartily | |
int frobnitz(int foo) | |
{ | |
int i; | |
for(i = 0; i < 10; i++) | |
{ | |
printf("Your answer is: "); | |
printf("%d\n", foo); | |
} | |
} | |
int fact(int n) | |
{ | |
if(n > 1) | |
{ | |
return fact(n-1) * n; | |
} | |
return 1; | |
} | |
int main(int argc, char **argv) | |
{ | |
frobnitz(fact(10)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fib(int n) | |
{ | |
if(n > 2) | |
{ | |
return fib(n-1) + fib(n-2); | |
} | |
return 1; | |
} | |
// Frobs foo heartily | |
int frobnitz(int foo) | |
{ | |
int i; | |
for(i = 0; i < 10; i++) | |
{ | |
printf("%d\n", foo); | |
} | |
} | |
int main(int argc, char **argv) | |
{ | |
frobnitz(fib(10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment