Skip to content

Commit

Permalink
c#
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-den committed Mar 12, 2018
1 parent 15b1056 commit cfbcbb9
Show file tree
Hide file tree
Showing 5 changed files with 10,020 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"name": ".NET Core quicksort",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build week2 cs",
"preLaunchTask": "build cs week2",
"program": "${workspaceFolder}/tasks/quodnon/week2/quick_fun/bin/Debug/netcoreapp2.0/quick_fun.dll",
"args": [],
"cwd": "${workspaceFolder}/tasks/quodnon/week2/quick_fun",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/tasks/quodnon/week2/quick-sort-tdd/quick-sort-tdd.sln"
"${workspaceFolder}/tasks/quodnon/week2/quick_fun/quick_fun.csproj"
],
"problemMatcher": "$msCompile"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ module QuickSort =
match mess with
| [] -> [] , 0L
| head::tail ->
counter <-counter+int64(tail.Length-1)
// counter <-counter+int64(tail.Length-1)

let (leftPivot, count1) = tail
|> List.filter (fun e -> e<head )
|> quicksortFirst <|counter

// counter<-counter+count1
counter<-counter+count1

let (rightToPivot, count2) = tail
|>List.filter (fun e -> e>=head)
|> quicksortFirst <|counter

// counter<-counter+count2
counter<-counter+count2
let result = List.concat [leftPivot; [head]; rightToPivot]
result ,counter

Expand All @@ -50,5 +50,5 @@ module QuickSort =
| [] -> []
| head::tail -> rev tail @ [head]

[5;4;3;2;1] |> rev |> printf "%A"
(quicksortFirst [5;4;3;2;1] 0L ) |> printf "%A"
//quicksortFirst unsortedList 0L|>snd |>printf "%A"
19 changes: 14 additions & 5 deletions tasks/quodnon/week2/quick_fun/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;


namespace quick_fun
{
Expand All @@ -7,15 +11,20 @@ class Program
static void Main(string[] args)
{
Console.WriteLine("Hello World! with good git config ");
var unsortedArr = File.ReadAllText("QuickSort.txt").Split('\n').Select(x => Int32.Parse(x)).ToArray();


}

static enum pivotPoint{
Last:0,
First:1,
Middle:2
enum pivotPoint{
Last=0,
First=1,
Middle=2
}
static int[] QuickSort (int [] array, enum pivotPoint)

static int[] QuickSort (int [] array, enum pivotPoin, out int counter)
{

}
}
}
Loading

0 comments on commit cfbcbb9

Please sign in to comment.