├── .gitattributes ├── .gitignore ├── GraphLayout.dll ├── GuilanDataStructures.sln ├── GuilanDataStructures ├── Animation.cs ├── App.config ├── App.xaml ├── App.xaml.cs ├── AppIcon.ico ├── CommonControls │ ├── ButtonBoxControls │ │ ├── GeoLines │ │ │ ├── Horizontal.xaml │ │ │ ├── Horizontal.xaml.cs │ │ │ ├── LeftToDown.xaml │ │ │ ├── LeftToDown.xaml.cs │ │ │ ├── LeftToUp.xaml │ │ │ ├── LeftToUp.xaml.cs │ │ │ ├── RightToDown.xaml │ │ │ ├── RightToDown.xaml.cs │ │ │ ├── UpToRight.xaml │ │ │ ├── UpToRight.xaml.cs │ │ │ ├── Vertical.xaml │ │ │ └── Vertical.xaml.cs │ │ ├── GeoPaths │ │ │ ├── Down.xaml │ │ │ ├── Down.xaml.cs │ │ │ ├── Left.xaml │ │ │ ├── Left.xaml.cs │ │ │ ├── Right.xaml │ │ │ ├── Right.xaml.cs │ │ │ ├── Up.xaml │ │ │ └── Up.xaml.cs │ │ ├── MazeButton.cs │ │ ├── ResizableButtonBox.xaml │ │ └── ResizableButtonBox.xaml.cs │ ├── ProjectCard.xaml │ └── ProjectCard.xaml.cs ├── DataStructures │ ├── BinaryTree.cs │ ├── Generic │ │ ├── BinaryTree.cs │ │ ├── PriorityQueue.cs │ │ └── Treap.cs │ ├── Huffman │ │ ├── BinaryTree.cs │ │ ├── Decoder.cs │ │ ├── Encoder.cs │ │ └── Utilities.cs │ └── PriorityQueue.cs ├── Extentions.cs ├── GuilanDataStructures.csproj ├── IRAN.ttf ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── ProjectSelector.xaml ├── ProjectSelector.xaml.cs ├── Projects │ ├── Project1 │ │ ├── BoresheMostatil.xaml │ │ └── BoresheMostatil.xaml.cs │ ├── Project2 │ │ ├── CharFrequency.xaml │ │ ├── CharFrequency.xaml.cs │ │ ├── CompressedText.xaml │ │ ├── CompressedText.xaml.cs │ │ ├── DecompressHuffman.xaml │ │ ├── DecompressHuffman.xaml.cs │ │ ├── MainHost.xaml │ │ ├── MainHost.xaml.cs │ │ ├── TreeView.xaml │ │ └── TreeView.xaml.cs │ ├── Project3 │ │ ├── NullChild.xaml │ │ ├── NullChild.xaml.cs │ │ ├── Treap.xaml │ │ └── Treap.xaml.cs │ └── Project4 │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── ProjectDescribe.xaml │ │ └── ProjectDescribe.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── IRAN.ttf │ ├── Images │ │ ├── AirPlay.png │ │ ├── Archive-64.png │ │ ├── BlueFlag.png │ │ ├── Database64.png │ │ ├── Guilan.png │ │ ├── Hard to Find-64.png │ │ ├── Left View-64.png │ │ ├── Pyramids-64.png │ │ ├── RedFlag.png │ │ ├── SourceCode.png │ │ ├── Stack64.png │ │ └── Tree48.png │ ├── Sahel-Black.ttf │ ├── Sahel-Bold.ttf │ └── Sahel.ttf └── Utilities.cs ├── LICENSE ├── Media └── GDS.gif ├── README.md └── TreeContainer.dll /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /GraphLayout.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avestura/data-structure-app/90813f70e4e8a9b811933ea2b74f369a6f2aa0f4/GraphLayout.dll -------------------------------------------------------------------------------- /GuilanDataStructures.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuilanDataStructures", "GuilanDataStructures\GuilanDataStructures.csproj", "{EA3D4AF4-F382-4215-A4FB-1C77F15D8416}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EA3D4AF4-F382-4215-A4FB-1C77F15D8416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {EA3D4AF4-F382-4215-A4FB-1C77F15D8416}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {EA3D4AF4-F382-4215-A4FB-1C77F15D8416}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {EA3D4AF4-F382-4215-A4FB-1C77F15D8416}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /GuilanDataStructures/Animation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Media.Animation; 8 | 9 | namespace GuilanDataStructures 10 | { 11 | public static class Animation 12 | { 13 | 14 | public static void HideUsingLinearAnimation(this UIElement element, int milliSeconds = 500) 15 | { 16 | if (element == null) return; 17 | var anim = new DoubleAnimation() 18 | { 19 | From = 1, 20 | To = 0, 21 | Duration = new TimeSpan(0, 0, 0, 0, milliSeconds) 22 | }; 23 | 24 | anim.Completed += new EventHandler((sender, e) => 25 | { 26 | element.Visibility = Visibility.Collapsed; 27 | }); 28 | element.Opacity = 1; 29 | element.Visibility = Visibility.Visible; 30 | element.BeginAnimation(UIElement.OpacityProperty, anim); 31 | 32 | 33 | 34 | } 35 | 36 | public static void ShowUsingLinearAnimation(this UIElement element, int milliSeconds = 500) 37 | { 38 | if (element == null) return; 39 | var anim = new DoubleAnimation() 40 | { 41 | From = 0, 42 | To = 1, 43 | Duration = new TimeSpan(0, 0, 0, 0, milliSeconds) 44 | }; 45 | 46 | element.Opacity = 0; 47 | element.Visibility = Visibility.Visible; 48 | element.BeginAnimation(UIElement.OpacityProperty, anim); 49 | 50 | } 51 | 52 | public static Task HideUsingLinearAnimationAsync(this UIElement element, int milliSeconds = 500) 53 | { 54 | return Task.Run(async() => 55 | { 56 | if (element == null) return; 57 | element.Dispatcher.Invoke(() => 58 | { 59 | HideUsingLinearAnimation(element, milliSeconds); 60 | }); 61 | await Task.Delay(milliSeconds); 62 | }); 63 | } 64 | 65 | public static Task ShowUsingLinearAnimationAsync(this UIElement element, int milliSeconds = 500) 66 | { 67 | return Task.Run(async() => 68 | { 69 | if (element == null) return; 70 | element.Dispatcher.Invoke(() => 71 | { 72 | ShowUsingLinearAnimation(element, milliSeconds); 73 | }); 74 | await Task.Delay(milliSeconds); 75 | }); 76 | } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /GuilanDataStructures/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GuilanDataStructures/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | Sahel, pack://application:,,,/GuilanDataStructures;Component/Resources/#Sahel 11 | pack://application:,,,/GuilanDataStructures;Component/Resources/#IRAN 12 | 40 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /GuilanDataStructures/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | 10 | namespace GuilanDataStructures 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class App : Application 16 | { 17 | 18 | public static MainWindow MainWindowApp { get; set; } 19 | public static Projects.Project2.MainHost Project2MainHost { get; set; } 20 | 21 | protected override void OnStartup(StartupEventArgs e) 22 | { 23 | base.OnStartup(e); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GuilanDataStructures/AppIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avestura/data-structure-app/90813f70e4e8a9b811933ea2b74f369a6f2aa0f4/GuilanDataStructures/AppIcon.ico -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/Horizontal.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/Horizontal.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for Horizontal.xaml 20 | /// 21 | public partial class Horizontal : UserControl 22 | { 23 | public Horizontal() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/LeftToDown.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/LeftToDown.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for LeftToDown.xaml 20 | /// 21 | public partial class LeftToDown : UserControl 22 | { 23 | public LeftToDown() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/LeftToUp.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/LeftToUp.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for LeftToUp.xaml 20 | /// 21 | public partial class LeftToUp : UserControl 22 | { 23 | public LeftToUp() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/RightToDown.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/RightToDown.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for RightToDown.xaml 20 | /// 21 | public partial class RightToDown : UserControl 22 | { 23 | public RightToDown() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/UpToRight.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/UpToRight.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for UpToRight.xaml 20 | /// 21 | public partial class UpToRight : UserControl 22 | { 23 | public UpToRight() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/Vertical.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoLines/Vertical.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines 17 | { 18 | /// 19 | /// Interaction logic for Vertical.xaml 20 | /// 21 | public partial class Vertical : UserControl 22 | { 23 | public Vertical() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Down.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Down.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoPaths 17 | { 18 | /// 19 | /// Interaction logic for Down.xaml 20 | /// 21 | public partial class Down : UserControl 22 | { 23 | public Down() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Left.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Left.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoPaths 17 | { 18 | /// 19 | /// Interaction logic for Left.xaml 20 | /// 21 | public partial class Left : UserControl 22 | { 23 | public Left() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Right.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Right.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoPaths 17 | { 18 | /// 19 | /// Interaction logic for Right.xaml 20 | /// 21 | public partial class Right : UserControl 22 | { 23 | public Right() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Up.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/GeoPaths/Up.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls.GeoPaths 17 | { 18 | /// 19 | /// Interaction logic for Up.xaml 20 | /// 21 | public partial class Up : UserControl 22 | { 23 | public Up() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/MazeButton.cs: -------------------------------------------------------------------------------- 1 | using GuilanDataStructures.CommonControls.ButtonBoxControls.GeoLines; 2 | using GuilanDataStructures.CommonControls.ButtonBoxControls.GeoPaths; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | 14 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls 15 | { 16 | public class MazeButton : System.Windows.Controls.Button 17 | { 18 | 19 | public ResizableButtonBox Father { get; set; } 20 | 21 | public bool IsStartPoint 22 | { 23 | get { return (bool)GetValue(IsStartPointProperty); } 24 | set { SetValue(IsStartPointProperty, value); } 25 | } 26 | 27 | public bool IsEndPoint 28 | { 29 | get { return (bool)GetValue(IsEndPointProperty); } 30 | set { SetValue(IsEndPointProperty, value); } 31 | } 32 | 33 | public bool IsBlock 34 | { 35 | get { return (bool)GetValue(IsBlockProperty); } 36 | set { SetValue(IsBlockProperty, value); } 37 | } 38 | 39 | public bool IsVisited 40 | { 41 | get { return (bool)GetValue(IsVisitedProperty); } 42 | set { SetValue(IsVisitedProperty, value); } 43 | } 44 | 45 | public MazeButton Previous 46 | { 47 | get { return (MazeButton)GetValue(PreviousProperty); } 48 | set { SetValue(PreviousProperty, value); } 49 | } 50 | 51 | public MazeButton Next 52 | { 53 | get { return (MazeButton)GetValue(NextProperty); } 54 | set { SetValue(NextProperty, value); } 55 | } 56 | 57 | public static readonly DependencyProperty NextProperty = 58 | DependencyProperty.Register("Next", typeof(MazeButton), typeof(MazeButton), null); 59 | 60 | public static readonly DependencyProperty PreviousProperty = 61 | DependencyProperty.Register("Previous", typeof(MazeButton), typeof(MazeButton), null); 62 | 63 | public static readonly DependencyProperty IsVisitedProperty = 64 | DependencyProperty.Register("IsVisited", typeof(bool), typeof(MazeButton), null); 65 | 66 | public static readonly DependencyProperty IsBlockProperty = 67 | DependencyProperty.Register("IsBlock", typeof(bool), typeof(MazeButton), null); 68 | 69 | public static readonly DependencyProperty IsEndPointProperty = 70 | DependencyProperty.Register("IsEndPoint", typeof(bool), typeof(MazeButton), null); 71 | 72 | public static readonly DependencyProperty IsStartPointProperty = 73 | DependencyProperty.Register("IsStartPoint", typeof(bool), typeof(MazeButton), null); 74 | 75 | public MazeButton() : base() 76 | { 77 | 78 | VerticalContentAlignment = VerticalAlignment.Center; 79 | HorizontalContentAlignment = HorizontalAlignment.Center; 80 | Padding = new Thickness(0); 81 | 82 | Click += (s, e) => 83 | { 84 | if (!IsStartPoint && !IsEndPoint) 85 | { 86 | IsBlock = (IsBlock) ? false : true; 87 | 88 | CheckFatherPanelForPath(); 89 | 90 | } 91 | 92 | }; 93 | 94 | MouseUp += (s, e) => 95 | { 96 | if (e.RightButton == System.Windows.Input.MouseButtonState.Released) 97 | { 98 | if (!IsBlock) { 99 | 100 | if (IsStartPoint) 101 | { 102 | IsStartPoint = false; 103 | Father.MazeStartPoint = null; 104 | ResetFatherScene(); 105 | Content = ""; 106 | } 107 | else if (IsEndPoint) 108 | { 109 | IsEndPoint = false; 110 | Father.MazeEndPoint = null; 111 | ResetFatherScene(); 112 | Content = ""; 113 | } 114 | else if (!Father.HasEndPoint) 115 | { 116 | IsEndPoint = true; 117 | Father.MazeEndPoint = this; 118 | Content = new Image() { 119 | Source = new BitmapImage( 120 | new Uri("/GuilanDataStructures;component/Resources/Images/RedFlag.png", UriKind.Relative)), 121 | Height = 18, 122 | Width = 18, 123 | Stretch = Stretch.None 124 | }; 125 | } 126 | else if (!Father.HasStartPoint) 127 | { 128 | IsStartPoint = true; 129 | Father.MazeStartPoint = this; 130 | Content = new Image() 131 | { 132 | Source = new BitmapImage( 133 | new Uri("/GuilanDataStructures;component/Resources/Images/BlueFlag.png", UriKind.Relative)), 134 | Height = 18, 135 | Width = 18, 136 | Stretch = Stretch.None 137 | }; 138 | } 139 | 140 | CheckFatherPanelForPath(); 141 | 142 | } 143 | 144 | } 145 | 146 | }; 147 | 148 | } 149 | 150 | public void ResetFatherScene() 151 | { 152 | foreach (var btn in Father.ButtonsList) 153 | { 154 | btn.IsVisited = false; 155 | btn.Previous = null; 156 | 157 | if (!btn.IsStartPoint && !btn.IsEndPoint) 158 | { 159 | btn.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFDDDDDD")); 160 | btn.Content = ""; 161 | } 162 | } 163 | } 164 | 165 | public void CheckFatherPanelForPath() 166 | { 167 | if (Father.HasEndPoint && Father.HasStartPoint) 168 | { 169 | 170 | ResetFatherScene(); 171 | 172 | if(Father.UseDFS) 173 | Father.CreatePathUsingDFS(Father.MazeStartPoint); 174 | else 175 | Father.CreatePathUsingBFS(Father.MazeStartPoint); 176 | 177 | var temp = Father.MazeEndPoint; 178 | var tempPrev = Father.MazeEndPoint.Previous; 179 | 180 | while (tempPrev != null && tempPrev != Father.MazeStartPoint) 181 | { 182 | tempPrev.Next = temp; 183 | // Use green-background only for bfs 184 | if (!Father.UseDFS) 185 | { 186 | tempPrev.Background = new RadialGradientBrush( 187 | (Color)ColorConverter.ConvertFromString("#FF8BFF84"), 188 | (Color)ColorConverter.ConvertFromString("#FF7AE573") 189 | ); 190 | } 191 | 192 | int tempIndex = Father.ButtonsList.IndexOf(tempPrev); 193 | int prevIndex = Father.ButtonsList.IndexOf(tempPrev.Previous); 194 | int nextIndex = Father.ButtonsList.IndexOf(tempPrev.Next); 195 | 196 | // Graphical Paths for DFS and BFS 197 | if (Father.UseDFS) 198 | { 199 | 200 | if (prevIndex == Father.GetNorth(tempIndex)) 201 | { 202 | if (nextIndex == Father.GetSouth(tempIndex)) 203 | { 204 | tempPrev.Content = new Vertical(); 205 | } 206 | 207 | else if (nextIndex == Father.GetEast(tempIndex)) 208 | { 209 | tempPrev.Content = new LeftToUp(); 210 | } 211 | 212 | else if (nextIndex == Father.GetWest(tempIndex)) 213 | { 214 | tempPrev.Content = new UpToRight(); 215 | 216 | } 217 | } 218 | 219 | else if (prevIndex == Father.GetSouth(tempIndex)) 220 | { 221 | if (nextIndex == Father.GetNorth(tempIndex)) 222 | { 223 | tempPrev.Content = new Vertical(); 224 | } 225 | 226 | else if (nextIndex == Father.GetEast(tempIndex)) 227 | { 228 | tempPrev.Content = new LeftToDown(); 229 | } 230 | 231 | else if (nextIndex == Father.GetWest(tempIndex)) 232 | { 233 | tempPrev.Content = new RightToDown(); 234 | 235 | } 236 | } 237 | 238 | else if (prevIndex == Father.GetEast(tempIndex)) 239 | { 240 | if (nextIndex == Father.GetSouth(tempIndex)) 241 | { 242 | tempPrev.Content = new LeftToDown(); 243 | } 244 | 245 | else if (nextIndex == Father.GetNorth(tempIndex)) 246 | { 247 | tempPrev.Content = new LeftToUp(); 248 | } 249 | 250 | else if (nextIndex == Father.GetWest(tempIndex)) 251 | { 252 | tempPrev.Content = new Horizontal(); 253 | 254 | } 255 | } 256 | 257 | else if (prevIndex == Father.GetWest(tempIndex)) 258 | { 259 | if (nextIndex == Father.GetSouth(tempIndex)) 260 | { 261 | tempPrev.Content = new RightToDown(); 262 | } 263 | 264 | else if (nextIndex == Father.GetNorth(tempIndex)) 265 | { 266 | tempPrev.Content = new UpToRight(); 267 | } 268 | 269 | else if (nextIndex == Father.GetEast(tempIndex)) 270 | { 271 | tempPrev.Content = new Horizontal(); 272 | 273 | } 274 | } 275 | 276 | } 277 | else 278 | { 279 | if (prevIndex == Father.GetNorth(tempIndex)) 280 | tempPrev.Content = new Up(); 281 | else if (prevIndex == Father.GetSouth(tempIndex)) 282 | tempPrev.Content = new Down(); 283 | else if (prevIndex == Father.GetEast(tempIndex)) 284 | tempPrev.Content = new Right(); 285 | else if (prevIndex == Father.GetWest(tempIndex)) 286 | tempPrev.Content = new Left(); 287 | } 288 | 289 | temp = temp.Previous; 290 | tempPrev = tempPrev.Previous; 291 | } 292 | } 293 | } 294 | 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/ResizableButtonBox.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 | 111 | 112 | 116 | 123 | 124 | 133 | 144 | 145 | 150 | Resize the playground using the corner thumb. 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ButtonBoxControls/ResizableButtonBox.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace GuilanDataStructures.CommonControls.ButtonBoxControls 18 | { 19 | /// 20 | /// Interaction logic for ResizableButtonBox.xaml 21 | /// 22 | public partial class ResizableButtonBox : UserControl 23 | { 24 | 25 | public bool HasStartPoint { get { return MazeStartPoint != null; } } 26 | public bool HasEndPoint { get { return MazeEndPoint != null; } } 27 | 28 | public int MazeWidth { get; set; } 29 | public int MazeHeight { get; set; } 30 | 31 | public List ButtonsList { get; set; } = new List(); 32 | 33 | public MazeButton MazeStartPoint { get; set; } 34 | public MazeButton MazeEndPoint { get; set; } 35 | 36 | public bool UseDFS 37 | { 38 | get { return (bool)GetValue(UseDFSProperty); } 39 | set { SetValue(UseDFSProperty, value); } 40 | } 41 | 42 | public static readonly DependencyProperty UseDFSProperty = 43 | DependencyProperty.Register("UseDFS", typeof(bool), typeof(ResizableButtonBox), null); 44 | 45 | public ResizableButtonBox() 46 | { 47 | InitializeComponent(); 48 | 49 | } 50 | 51 | private void mainArea_SizeChanged(object sender, SizeChangedEventArgs e) 52 | { 53 | 54 | } 55 | 56 | private void Thumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) 57 | { 58 | areaText.Visibility = Visibility.Visible; 59 | 60 | MazeStartPoint = null; 61 | MazeEndPoint = null; 62 | 63 | ButtonsList.Clear(); 64 | 65 | mainArea.Children.Clear(); 66 | mainArea.Background = Brushes.LightBlue; 67 | 68 | rect.Stroke = Brushes.Blue; 69 | rect.StrokeDashArray = new DoubleCollection(new double[] { 4, 4}); 70 | 71 | } 72 | 73 | private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) 74 | { 75 | 76 | int horizontalChange = (int)e.HorizontalChange; 77 | int verticalChange = (int)e.VerticalChange; 78 | 79 | bool newHorizontalSizeAvailable = (canvas.ActualWidth + horizontalChange) >= 42; 80 | bool newVerticalSizeAvailable = (canvas.ActualHeight + verticalChange ) >= 42; 81 | 82 | if (newHorizontalSizeAvailable) 83 | { 84 | canvas.Width += horizontalChange; 85 | Canvas.SetLeft(areaText, (canvas.ActualWidth - areaText.ActualWidth)/2d); 86 | areaText.Text = $"{(int)canvas.ActualWidth / 20} x {(int)canvas.ActualHeight / 20}"; 87 | 88 | } 89 | if (newVerticalSizeAvailable) 90 | { 91 | canvas.Height += verticalChange; 92 | Canvas.SetTop(areaText, (canvas.ActualHeight - areaText.ActualHeight) / 2d); 93 | areaText.Text = $"{(int)canvas.ActualWidth / 20} x {(int)canvas.ActualHeight / 20}"; 94 | 95 | } 96 | } 97 | 98 | public void RecreateButtons(int buttons) 99 | { 100 | mainArea.Background = Brushes.White; 101 | 102 | for (int i = 0; i < buttons; i++) 103 | { 104 | 105 | var createdButton = new MazeButton() 106 | { 107 | Width = 20, 108 | Height = 20, 109 | IsBlock = false, 110 | IsEndPoint = false, 111 | IsStartPoint = false, 112 | IsVisited = false, 113 | Father = this, 114 | //Content = i 115 | }; 116 | ButtonsList.Add(createdButton); 117 | mainArea.Children.Add(createdButton); 118 | } 119 | 120 | } 121 | 122 | private void Thumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) 123 | { 124 | areaText.Visibility = Visibility.Hidden; 125 | rect.Stroke = Brushes.Gray; 126 | rect.StrokeDashArray = new DoubleCollection() { 21 }; 127 | 128 | int horizontalButtonSpace = ((int)canvas.ActualWidth / 20); 129 | int verticalButtonSpace = ((int)canvas.ActualHeight / 20); 130 | 131 | canvas.Width = (horizontalButtonSpace * 20d) + 2d; 132 | canvas.Height = (verticalButtonSpace * 20d) + 2d; 133 | 134 | MazeWidth = horizontalButtonSpace; 135 | MazeHeight = verticalButtonSpace; 136 | 137 | RecreateButtons(horizontalButtonSpace * verticalButtonSpace); 138 | } 139 | 140 | private void Thumb_DragOver(object sender, DragEventArgs e) 141 | { 142 | 143 | } 144 | 145 | public void CreatePathUsingDFS(MazeButton mazeButton) 146 | { 147 | mazeButton.IsVisited = true; 148 | 149 | int buttonIndex = ButtonsList.IndexOf(mazeButton); 150 | 151 | foreach (var btn in GetAdjacent(buttonIndex)) 152 | { 153 | if (!btn.IsVisited && !btn.IsBlock) 154 | { 155 | btn.Previous = mazeButton; 156 | CreatePathUsingDFS(btn); 157 | 158 | } 159 | 160 | } 161 | 162 | } 163 | 164 | public void CreatePathUsingBFS(MazeButton mazeButton) 165 | { 166 | var queue = new Queue(); 167 | 168 | mazeButton.IsVisited = true; 169 | queue.Enqueue(mazeButton); 170 | while(queue.Count != 0) 171 | { 172 | var e = queue.Dequeue(); 173 | int buttonIndex = ButtonsList.IndexOf(e); 174 | 175 | foreach (var btn in GetAdjacent(buttonIndex)) 176 | { 177 | if (btn == MazeEndPoint) 178 | { 179 | MazeEndPoint.Previous = e; 180 | return; 181 | } 182 | if (!btn.IsVisited && !btn.IsBlock) 183 | { 184 | btn.Previous = e; 185 | btn.IsVisited = true; 186 | 187 | queue.Enqueue(btn); 188 | 189 | } 190 | } 191 | } 192 | } 193 | 194 | public bool HasNorth(int index) { return index >= MazeWidth; } 195 | public int GetNorth(int index) { return index - MazeWidth; } 196 | public bool HasSouth(int index) { return (index / MazeWidth) < MazeHeight - 1 ; } 197 | public int GetSouth(int index) { return index + MazeWidth; } 198 | public bool HasWest(int index) { return (index + 1) % MazeWidth != 0; } 199 | public int GetWest(int index) { return index + 1; } 200 | public bool HasEast(int index) { return index % MazeWidth != 0; } 201 | public int GetEast(int index) { return index - 1; } 202 | public MazeButton[] GetAdjacent(int index) 203 | { 204 | var adj = new List(); 205 | if (HasWest(index)) adj.Add(ButtonsList[GetWest(index)]); 206 | if (HasNorth(index)) adj.Add(ButtonsList[GetNorth(index)]); 207 | if (HasEast(index)) adj.Add(ButtonsList[GetEast(index)]); 208 | if (HasSouth(index)) adj.Add(ButtonsList[GetSouth(index)]); 209 | 210 | //MessageBox.Show(GetEast(index).ToString()); 211 | //MessageBox.Show(GetWest(index).ToString()); 212 | //MessageBox.Show(GetNorth(index).ToString()); 213 | //MessageBox.Show(GetSouth(index).ToString()); 214 | 215 | return adj.ToArray(); 216 | } 217 | 218 | } 219 | 220 | public class HeighDecreaser : IValueConverter 221 | { 222 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 223 | { 224 | int val = (int)((double)value); 225 | return val - 2; 226 | } 227 | 228 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 229 | { 230 | int val = (int)((double)value); 231 | return val + 2; 232 | } 233 | } 234 | 235 | } 236 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ProjectCard.xaml: -------------------------------------------------------------------------------- 1 |  20 | 21 | 70 | 71 | 72 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 90 | 99 | 100 | 101 | 105 | 109 | Designer: 110 | 115 | 116 | 117 | Programming Language: 118 | 123 | 124 | 125 | Developer: 126 | 131 | 132 | 133 | Tags: 134 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 163 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /GuilanDataStructures/CommonControls/ProjectCard.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.CommonControls 17 | { 18 | /// 19 | /// Interaction logic for ProjectCard.xaml 20 | /// 21 | public partial class ProjectCard : UserControl 22 | { 23 | 24 | public event RoutedEventHandler ClickedViewProject; 25 | 26 | 27 | public string ProjectTitle 28 | { 29 | get { return projectTitle.Text; } 30 | set { projectTitle.Text = value; } 31 | } 32 | 33 | 34 | 35 | public string QuestionDesigner 36 | { 37 | get { return questionDesigner.Text; } 38 | set { questionDesigner.Text = value; } 39 | } 40 | 41 | 42 | 43 | public string ProgrammingLanguage 44 | { 45 | get { return programmingLanguage.Text; } 46 | set { programmingLanguage.Text = value; } 47 | } 48 | 49 | 50 | 51 | public string Programmer 52 | { 53 | get { return programmer.Text; } 54 | set { programmer.Text = value; } 55 | } 56 | 57 | 58 | 59 | public string Tags 60 | { 61 | get { return tag.Text; } 62 | set { tag.Text = value; } 63 | } 64 | 65 | 66 | 67 | public ImageSource ImageSource 68 | { 69 | get { return image.Source; } 70 | set { image.Source = value; } 71 | } 72 | 73 | public static readonly DependencyProperty MyPropertyProperty = 74 | DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ProjectCard), null); 75 | 76 | public static readonly DependencyProperty TagsProperty = 77 | DependencyProperty.Register("Tags", typeof(string), typeof(ProjectCard), null); 78 | 79 | public static readonly DependencyProperty ProgrammerProperty = 80 | DependencyProperty.Register("Programmer", typeof(string), typeof(ProjectCard), null); 81 | 82 | public static readonly DependencyProperty ProgrammingLanguageProperty = 83 | DependencyProperty.Register("ProgrammingLanguage", typeof(string), typeof(ProjectCard), null); 84 | 85 | public static readonly DependencyProperty QuestionDesignerProperty = 86 | DependencyProperty.Register("QuestionDesigner", typeof(string), typeof(ProjectCard), null); 87 | 88 | public static readonly DependencyProperty ProjectTitleProperty = 89 | DependencyProperty.Register("ProjectTitle", typeof(string), typeof(ProjectCard), null); 90 | 91 | 92 | 93 | public ProjectCard() 94 | { 95 | InitializeComponent(); 96 | } 97 | 98 | private void viewButton_Click(object sender, RoutedEventArgs e) 99 | { 100 | if (ClickedViewProject != null) 101 | ClickedViewProject(this, e); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/BinaryTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GuilanDataStructures.DataStructures 8 | { 9 | public class BinaryTree 10 | { 11 | 12 | private BinaryTree left; 13 | private BinaryTree right; 14 | 15 | public object Data { get; set; } 16 | public BinaryTree Left 17 | { 18 | get { return left; } 19 | set { left = value; left.Parent = this; } 20 | } 21 | public BinaryTree Right 22 | { 23 | get { return right; } 24 | set { right = value; right.Parent = this; } 25 | } 26 | 27 | public BinaryTree Parent { get; private set; } 28 | 29 | public BinaryTree RightestChild() 30 | { 31 | BinaryTree tree = Right; 32 | while(tree.Right != null) 33 | { 34 | tree = tree.right; 35 | } 36 | return tree; 37 | } 38 | 39 | public BinaryTree LeftestChild() 40 | { 41 | BinaryTree tree = Left; 42 | while (tree.Left != null) 43 | { 44 | tree = tree.Left; 45 | } 46 | return tree; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Generic/BinaryTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GuilanDataStructures.DataStructures.Generic 8 | { 9 | public class BinaryTree 10 | { 11 | 12 | private BinaryTree left; 13 | private BinaryTree right; 14 | 15 | public T Data { get; set; } 16 | public int TreeNumber { get; set; } 17 | 18 | public BinaryTree Left 19 | { 20 | get { return left; } 21 | set { left = value; /*left.Parent = this;*/ } 22 | } 23 | public BinaryTree Right 24 | { 25 | get { return right; } 26 | set { right = value; /*right.Parent = this;*/ } 27 | } 28 | 29 | //public BinaryTree Parent { get; private set; } 30 | 31 | public BinaryTree RightestChild() 32 | { 33 | BinaryTree tree = Right; 34 | while (tree.Right != null) 35 | { 36 | tree = tree.right; 37 | } 38 | return tree; 39 | } 40 | 41 | public BinaryTree LeftestChild() 42 | { 43 | BinaryTree tree = Left; 44 | while (tree.Left != null) 45 | { 46 | tree = tree.Left; 47 | } 48 | return tree; 49 | } 50 | 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Generic/PriorityQueue.cs: -------------------------------------------------------------------------------- 1 | using GuilanDataStructures.DataStructures.Generic; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace GuilanDataStructures.DataStructures.Generic 9 | { 10 | public class PriorityQueue 11 | { 12 | 13 | List> Datas { get; set; } = new List>(); 14 | 15 | public int Size { get { return Datas.Count; } } 16 | 17 | public bool Empty { get { return (Datas.Count == 0); } } 18 | 19 | 20 | private int MaxHeapify(int position) 21 | { 22 | if (position > Datas.Count - 1) return -1; 23 | 24 | while (position > 0) 25 | { 26 | if (Datas[ParentLocationOf(position)].Priority < Datas[position].Priority) 27 | { 28 | SwapByIndex(ParentLocationOf(position), position); 29 | position = ParentLocationOf(position); 30 | } 31 | else break; 32 | } 33 | return position; 34 | 35 | } 36 | 37 | private void SwapByIndex(int index1, int index2) 38 | { 39 | var temp = Datas[index1]; 40 | Datas[index1] = Datas[index2]; 41 | Datas[index2] = temp; 42 | } 43 | 44 | public int ParentLocationOf(int position) 45 | { 46 | return (position - 1) / 2; 47 | } 48 | public bool HasLeft(int position) 49 | { 50 | return ((2 * position + 1) < Size); 51 | } 52 | public bool HasRight(int position) 53 | { 54 | return ((2 * position + 2) < Size); 55 | } 56 | public int LeftPositionOf(int position) 57 | { 58 | if (!HasLeft(position)) return -1; 59 | return (2 * position + 1); 60 | } 61 | public int RightPositionOf(int position) 62 | { 63 | if (!HasRight(position)) return -1; 64 | return (2 * position + 2); 65 | } 66 | 67 | public void EnqueueNew(int priority, T data) 68 | { 69 | 70 | Datas.Add(new QueueData(priority, data)); 71 | 72 | MaxHeapify(Datas.Count - 1); 73 | 74 | } 75 | 76 | public void Enqueue(QueueData q) 77 | { 78 | Datas.Add(q); 79 | MaxHeapify(Datas.Count - 1); 80 | } 81 | 82 | private void MoveDown(int index) 83 | { 84 | int largerIndex = index; 85 | 86 | if (HasLeft(index) && Datas[LeftPositionOf(index)].Priority > Datas[largerIndex].Priority) largerIndex = LeftPositionOf(index); 87 | if (HasRight(index) && Datas[RightPositionOf(index)].Priority > Datas[largerIndex].Priority) largerIndex = RightPositionOf(index); 88 | 89 | if (largerIndex != index) 90 | { 91 | SwapByIndex(largerIndex, index); 92 | MoveDown(largerIndex); 93 | } 94 | 95 | } 96 | 97 | public QueueData DequeueData() 98 | { 99 | QueueData tree = Datas[0]; 100 | Datas.RemoveAt(0); 101 | MoveLastItemToFirst(); 102 | MoveDown(0); 103 | return tree; 104 | } 105 | 106 | 107 | 108 | private void MoveLastItemToFirst() 109 | { 110 | if (Datas.Count == 0) return; 111 | var tree = Datas[Datas.Count - 1]; 112 | Datas.RemoveAt(Datas.Count - 1); 113 | Datas.Insert(0, tree); 114 | } 115 | 116 | 117 | public void Clear() 118 | { 119 | Datas.Clear(); 120 | } 121 | 122 | 123 | 124 | 125 | } 126 | 127 | public class QueueData 128 | { 129 | public T Data { get; set; } 130 | public int Priority { get; set; } 131 | 132 | public QueueData(){} 133 | public QueueData(int p, T d) 134 | { 135 | Data = d; 136 | Priority = p; 137 | } 138 | } 139 | 140 | 141 | } 142 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Generic/Treap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GuilanDataStructures.DataStructures.Generic 8 | { 9 | public class Treap where T : IComparable 10 | { 11 | 12 | public T Data { get; set; } 13 | 14 | public int Priority { get; set; } 15 | 16 | public Treap Right { get; set; } 17 | public Treap Left { get; set; } 18 | 19 | public Treap(T data, int priority) 20 | { 21 | Data = data; 22 | Priority = priority; 23 | } 24 | 25 | public Treap Insert(T data, int priority) 26 | { 27 | return Insert(this, data, priority); 28 | } 29 | 30 | 31 | 32 | public static Treap RotateRight(Treap y) 33 | { 34 | var x = y.Left; var xSubTree = x.Right; 35 | 36 | x.Right = y; y.Left = xSubTree; 37 | 38 | return x; 39 | } 40 | 41 | public static Treap LeftRotate(Treap x) 42 | { 43 | var y = x.Right; var ySubTree = y.Left; 44 | 45 | y.Left = x; 46 | x.Right = ySubTree; 47 | 48 | return y; 49 | } 50 | 51 | #region Static Methods 52 | public static Treap Insert(Treap tree, T data, int priority) 53 | { 54 | if (tree == null) return new Treap(data, priority); 55 | 56 | if (data.CompareTo(tree.Data) <= 0) 57 | { 58 | tree.Left = Insert(tree.Left, data, priority); 59 | 60 | if (tree.Left.Priority > tree.Priority) tree = RotateRight(tree); 61 | 62 | } 63 | else if (data.CompareTo(tree.Data) > 0) 64 | { 65 | tree.Right = Insert(tree.Right, data, priority); 66 | 67 | if (tree.Right.Priority > tree.Priority) tree = LeftRotate(tree); 68 | } 69 | 70 | return tree; 71 | } 72 | #endregion 73 | 74 | 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Huffman/BinaryTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GuilanDataStructures.DataStructures.Huffman 8 | { 9 | public class BinaryTree 10 | { 11 | public char? Character { get; set; } 12 | public int Repeat { get; set; } 13 | public bool HasCharacter { get { return (Character != null); } } 14 | public BinaryTree Left { get; set; } 15 | public BinaryTree Right { get; set; } 16 | 17 | public BinaryTree(int freq, char? ch = null) : base() 18 | { 19 | Repeat = freq; 20 | Character = ch; 21 | 22 | } 23 | 24 | public List Traverse(char ch, List memorizedPath) 25 | { 26 | // Set defualt value of tree parameter 27 | 28 | if (HasCharacter) 29 | { 30 | if (ch.Equals(Character)) 31 | return memorizedPath; 32 | return null; 33 | } 34 | else 35 | { 36 | 37 | List leftPath = null; 38 | List rightPath = null; 39 | 40 | 41 | if (Left != null) 42 | { 43 | var leftTraverseData = new List(memorizedPath); 44 | leftTraverseData.Add(true); 45 | 46 | leftPath = Left.Traverse(ch, leftTraverseData); 47 | 48 | } 49 | 50 | if (Right != null) 51 | { 52 | var rightTraverseData = new List(memorizedPath); 53 | rightTraverseData.Add(false); 54 | 55 | rightPath = Right.Traverse(ch, rightTraverseData); 56 | } 57 | 58 | if (leftPath != null) 59 | return leftPath; 60 | return rightPath; 61 | 62 | 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Huffman/Decoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace GuilanDataStructures.DataStructures.Huffman 10 | { 11 | public class Decoder 12 | { 13 | 14 | 15 | private const string MetaAndDataSeparatorString = "0000001000000000001001100000000001000110000000000101110000000000"; 16 | private const string CharMapCharacterSeparatorString = "00110100000000001101110000000000"; 17 | 18 | 19 | public void Decode(string fileUrl, string saveUrl) 20 | { 21 | 22 | var fileBits = new BitArray(File.ReadAllBytes(fileUrl)).ToNativeOneZeroString(); 23 | 24 | string[] splitedData = fileBits.Split(new string[] { MetaAndDataSeparatorString }, StringSplitOptions.None); 25 | 26 | string CharMapData = splitedData[0]; 27 | string HuffmanData = splitedData[1]; 28 | 29 | var frequencyModelList = new List(); 30 | 31 | frequencyModelList.FillModel(CharMapData, CharMapCharacterSeparatorString); 32 | 33 | var charactersOfDecompressedFile = new List(); 34 | 35 | File.WriteAllText(saveUrl, HuffmanData.DecompressDataUsingKeys(frequencyModelList)); 36 | 37 | 38 | } 39 | 40 | public class FrequencyModel 41 | { 42 | public char Character { get; set; } 43 | public string Replacement { get; set; } 44 | 45 | public FrequencyModel(char c, string k) 46 | { 47 | Character = c; 48 | Replacement = k; 49 | } 50 | } 51 | 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Huffman/Encoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace GuilanDataStructures.DataStructures.Huffman 9 | { 10 | public class Encoder 11 | { 12 | 13 | public PriorityQueue PQueue { get; set; } 14 | public BinaryTree Root { get; set; } 15 | 16 | private readonly byte[] MetaAndDataSeparatorKey = Encoding.Unicode.GetBytes("@db:"); 17 | private readonly byte[] CharMapCharacterSeparatorKey = Encoding.Unicode.GetBytes(",;"); 18 | 19 | private readonly bool[] MetaAndDataSeparatorBool = { false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, true, false, false, true, true, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, true, false, true, true, true, false, false, false, false, false, false, false, false, false, false }; 20 | private readonly bool[] CharMapCharacterSeparatorBool = { false, false, true, true, false, true, false, false, false, false, false, false, false, false, false, false, true, true, false, true, true, true, false, false, false, false, false, false, false, false, false, false }; 21 | 22 | public void Encode(string text, string url) 23 | { 24 | 25 | ResetEncoder(); 26 | 27 | PQueue = new PriorityQueue(); 28 | 29 | var charRepaetDictionary = text.CharacterRepeat(); 30 | 31 | PQueue.FillQueue(charRepaetDictionary); 32 | 33 | Root = PQueue.BuildTree(charRepaetDictionary); 34 | 35 | var codedCharactersDictionary = new Dictionary(); 36 | codedCharactersDictionary.FillDictionaryCode(text, Root); 37 | 38 | 39 | 40 | var bitDataToWriteOnHardDisk = new List(); 41 | 42 | bitDataToWriteOnHardDisk.AddRange(codedCharactersDictionary.EmbededCharMap(CharMapCharacterSeparatorBool)); 43 | bitDataToWriteOnHardDisk.AddRange(MetaAndDataSeparatorBool); 44 | bitDataToWriteOnHardDisk.AddRange(text.ToHuffmanData(codedCharactersDictionary)); 45 | 46 | File.WriteAllBytes(url, bitDataToWriteOnHardDisk.ToByteArray()); 47 | 48 | } 49 | 50 | public void EncodeFile(string filePath, string url) { 51 | Encode(File.ReadAllText(filePath), url); 52 | } 53 | 54 | 55 | public void ResetEncoder() 56 | { 57 | PQueue = null; 58 | Root = null; 59 | } 60 | 61 | 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/Huffman/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace GuilanDataStructures.DataStructures.Huffman 9 | { 10 | public static class Utilities 11 | { 12 | 13 | public static byte[] ToByteArray(this BitArray bArr) 14 | { 15 | byte[] bytes = new byte[bArr.Length / 8 + (bArr.Length % 8 == 0 ? 0 : 1)]; 16 | bArr.CopyTo(bytes, 0); 17 | return bytes; 18 | } 19 | 20 | public static string ToNativeOneZeroString(this BitArray bArr) 21 | { 22 | StringBuilder sBuilder = new StringBuilder(); 23 | for (int i = 0; i < bArr.Length; i++) sBuilder.Append((bArr[i]) ? "1" : "0"); 24 | return sBuilder.ToString(); 25 | } 26 | 27 | public static Dictionary CharacterRepeat(this string text) 28 | { 29 | var returnValue = new Dictionary(); 30 | foreach (char @char in text) 31 | { 32 | if (returnValue.ContainsKey(@char)) returnValue[@char]++; 33 | else returnValue.Add(@char, 1); 34 | } 35 | return returnValue; 36 | } 37 | 38 | public static BinaryTree BuildTree(this PriorityQueue pQ, Dictionary dic) 39 | { 40 | for (int i = 0; i < dic.Count - 1; i++) 41 | { 42 | var firstDequeue = pQ.DequeueData(); 43 | var secondDequeue = pQ.DequeueData(); 44 | var tree = new Huffman.BinaryTree(firstDequeue.Repeat + secondDequeue.Repeat, null); 45 | tree.Left = firstDequeue; 46 | tree.Right = secondDequeue; 47 | 48 | pQ.Enqueue(tree); 49 | 50 | } 51 | 52 | return pQ.DequeueData(); 53 | 54 | } 55 | 56 | public static void FillQueue(this PriorityQueue pQ, Dictionary repeats) 57 | { 58 | foreach (var element in repeats) 59 | pQ.EnqueueNew(element.Value, element.Key); 60 | } 61 | 62 | public static void FillDictionaryCode(this Dictionary dic, string text, BinaryTree root) 63 | { 64 | for (int i = 0; i < text.Length; i++) 65 | { 66 | // If character already exists in dictionary, no need to calculate it again 67 | if (dic.ContainsKey(text[i])) continue; 68 | 69 | bool[] codedCharacter = root.Traverse(text[i], new List()).ToArray(); 70 | 71 | dic.Add(text[i], codedCharacter); 72 | 73 | } 74 | } 75 | 76 | public static List EmbededCharMap(this Dictionary dic, bool[] charSeparator) 77 | { 78 | 79 | var list = new List(); 80 | 81 | foreach (var element in dic) 82 | { 83 | 84 | bool[] standardCharBits = new bool[16]; 85 | new BitArray(Encoding.Unicode.GetBytes(element.Key.ToString())).CopyTo(standardCharBits, 0); 86 | list.AddRange(standardCharBits); 87 | list.AddRange(element.Value); 88 | list.AddRange(charSeparator); 89 | 90 | } 91 | 92 | return list; 93 | } 94 | 95 | public static List ToHuffmanData(this string text, Dictionary codedChars) 96 | { 97 | var retuenValue = new List(); 98 | 99 | for (int i = 0; i < text.Length; i++) 100 | { 101 | char c = text[i]; 102 | retuenValue.AddRange(codedChars[c]); 103 | } 104 | 105 | return retuenValue; 106 | } 107 | 108 | public static byte[] ToByteArray(this List bools) 109 | { 110 | return new BitArray(bools.ToArray()).ToByteArray(); 111 | } 112 | 113 | public static void FillModel(this List dic, string metaData, string splitor) 114 | { 115 | string[] token = metaData.Split(new string[] { splitor }, StringSplitOptions.RemoveEmptyEntries); 116 | 117 | foreach (var c in token) 118 | { 119 | string bitsOfStandardChar = c.Substring(0, 16); 120 | string key = c.Substring(16); 121 | 122 | bool[] bools = new bool[16]; 123 | 124 | for (int i = 0; i < 16; i++) bools[i] = (bitsOfStandardChar[i] == '1') ? true : false; 125 | 126 | var characterBitArray = new BitArray(bools); 127 | 128 | byte[] byteOfBools = new byte[2]; 129 | characterBitArray.CopyTo(byteOfBools, 0); 130 | 131 | char character = Convert.ToChar(byteOfBools[0]); 132 | 133 | dic.Add(new Decoder.FrequencyModel(character, key)); 134 | 135 | } 136 | } 137 | 138 | public static string DecompressDataUsingKeys(this string data, List fModel) 139 | { 140 | var charsOfText = new List(); 141 | 142 | for (int i = 1; i < data.Length; i++) 143 | { 144 | string part = data.Substring(0, i); 145 | 146 | for (int j = 0; j < fModel.Count; j++) 147 | { 148 | if (part == fModel[j].Replacement) 149 | { 150 | charsOfText.Add(fModel[j].Character); 151 | data = data.Substring(i); 152 | i = 0; 153 | break; 154 | } 155 | } 156 | 157 | } 158 | 159 | return new string(charsOfText.ToArray()); 160 | } 161 | 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /GuilanDataStructures/DataStructures/PriorityQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace GuilanDataStructures.DataStructures 9 | { 10 | 11 | public class PriorityQueue 12 | { 13 | 14 | List Trees { get; set; } = new List(); 15 | 16 | public int Size { get { return Trees.Count; } } 17 | 18 | 19 | private int MinHeapify(int position) 20 | { 21 | if (position > Trees.Count - 1) return -1; 22 | 23 | while (position > 0) 24 | { 25 | if (Trees[ParentLocationOf(position)].Repeat > Trees[position].Repeat) 26 | { 27 | SwapByIndex(ParentLocationOf(position), position); 28 | position = ParentLocationOf(position); 29 | } 30 | else break; 31 | } 32 | return position; 33 | 34 | } 35 | 36 | private void SwapByIndex(int index1, int index2) 37 | { 38 | var temp = Trees[index1]; 39 | Trees[index1] = Trees[index2]; 40 | Trees[index2] = temp; 41 | } 42 | 43 | public int ParentLocationOf(int position) 44 | { 45 | return (position - 1) / 2; 46 | } 47 | public bool HasLeft(int position) 48 | { 49 | return ((2 * position + 1) < Size); 50 | } 51 | public bool HasRight(int position) 52 | { 53 | return ((2 * position + 2) < Size); 54 | } 55 | public int LeftPositionOf(int position) 56 | { 57 | if (!HasLeft(position)) return -1; 58 | return (2 * position + 1); 59 | } 60 | public int RightPositionOf(int position) 61 | { 62 | if (!HasRight(position)) return -1; 63 | return (2 * position + 2); 64 | } 65 | 66 | public void EnqueueNew(int priority, char? data) 67 | { 68 | 69 | Trees.Add(new Huffman.BinaryTree(priority, data)); 70 | 71 | MinHeapify(Trees.Count - 1); 72 | 73 | } 74 | 75 | public void Enqueue(Huffman.BinaryTree tree) 76 | { 77 | Trees.Add(tree); 78 | MinHeapify(Trees.Count - 1); 79 | } 80 | 81 | private void MoveDown(int index) 82 | { 83 | int lowerIndex = index; 84 | 85 | if (HasLeft(index) && Trees[LeftPositionOf(index)].Repeat < Trees[lowerIndex].Repeat) lowerIndex = LeftPositionOf(index); 86 | if (HasRight(index) && Trees[RightPositionOf(index)].Repeat < Trees[lowerIndex].Repeat)lowerIndex = RightPositionOf(index); 87 | 88 | if (lowerIndex != index) 89 | { 90 | SwapByIndex(lowerIndex, index); 91 | MoveDown(lowerIndex); 92 | } 93 | 94 | } 95 | 96 | public Huffman.BinaryTree DequeueData() 97 | { 98 | Huffman.BinaryTree tree = Trees[0]; 99 | Trees.RemoveAt(0); 100 | MoveLastItemToFirst(); 101 | MoveDown(0); 102 | return tree; 103 | } 104 | 105 | 106 | 107 | private void MoveLastItemToFirst() 108 | { 109 | if (Trees.Count == 0) return; 110 | var tree = Trees[Trees.Count - 1]; 111 | Trees.RemoveAt(Trees.Count - 1); 112 | Trees.Insert(0, tree); 113 | } 114 | 115 | 116 | public void Clear() 117 | { 118 | Trees.Clear(); 119 | } 120 | 121 | 122 | 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /GuilanDataStructures/Extentions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Collections; 7 | using GuilanDataStructures.DataStructures.Generic; 8 | 9 | namespace GuilanDataStructures 10 | { 11 | public static class Extentions 12 | { 13 | 14 | public static bool IsEmpty(this Stack stack) 15 | { 16 | if (stack.Count == 0) return true; return false; 17 | } 18 | 19 | public static bool IsEmpty(this Stack stack) 20 | { 21 | if (stack.Count == 0) return true; return false; 22 | } 23 | 24 | public static string ConvertTreeToString(this Treap treap) 25 | { 26 | if (treap == null) return string.Empty; 27 | return $"({ConvertTreeToString(treap.Left)}{treap.Data}/{treap.Priority}{ConvertTreeToString(treap.Right)})"; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GuilanDataStructures/IRAN.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avestura/data-structure-app/90813f70e4e8a9b811933ea2b74f369a6f2aa0f4/GuilanDataStructures/IRAN.ttf -------------------------------------------------------------------------------- /GuilanDataStructures/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | Data Structure Projects of Guilan University 36 | Professor: Dr. Mirroshandel 37 | 38 | 44 | 45 | Aryan Ebrahimpour 46 | 94012269008 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 66 | Select a project to run the demo or browse the source code: 67 | 68 | 75 | 85 | 86 | 87 | 88 | 93 | 94 | 95 | 99 | Guilan University, Fall 95 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /GuilanDataStructures/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | using GuilanDataStructures.Projects; 17 | using GuilanDataStructures.DataStructures; 18 | using GuilanDataStructures.DataStructures.Generic; 19 | 20 | namespace GuilanDataStructures 21 | { 22 | /// 23 | /// Interaction logic for MainWindow.xaml 24 | /// 25 | public partial class MainWindow : Window 26 | { 27 | 28 | ProjectSelector selectorPage = new ProjectSelector(); 29 | 30 | public MainWindow() 31 | { 32 | 33 | InitializeComponent(); 34 | //selectProjectCombo.ItemsSource = projects; 35 | App.MainWindowApp = this; 36 | 37 | } 38 | 39 | private void mainWindow_Loaded(object sender, RoutedEventArgs e) 40 | { 41 | 42 | } 43 | 44 | private void mainFrame_Loaded(object sender, RoutedEventArgs e) 45 | { 46 | mainFrame.Navigate(selectorPage); 47 | } 48 | 49 | private void showSourceButton_Click(object sender, RoutedEventArgs e) 50 | { 51 | mainFrame.Navigate(selectorPage); 52 | backToHome.HideUsingLinearAnimation(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /GuilanDataStructures/ProjectSelector.xaml: -------------------------------------------------------------------------------- 1 |  16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 58 | 59 | 68 | 69 | 78 | 79 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /GuilanDataStructures/ProjectSelector.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using GuilanDataStructures.Projects; 16 | 17 | namespace GuilanDataStructures 18 | { 19 | /// 20 | /// Interaction logic for ProjectSelector.xaml 21 | /// 22 | public partial class ProjectSelector : Page 23 | { 24 | public ProjectSelector() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | Projects.Project1.BoresheMostatil project1 = new Projects.Project1.BoresheMostatil(); 30 | Projects.Project2.MainHost project2 = new Projects.Project2.MainHost(); 31 | Projects.Project3.Treap project3 = new Projects.Project3.Treap(); 32 | Projects.Project4.ProjectDescribe project4 = new Projects.Project4.ProjectDescribe(); 33 | 34 | private void NavigateTo(object Navigation) 35 | { 36 | App.MainWindowApp.mainFrame.Navigate(Navigation); 37 | App.MainWindowApp.backToHome.ShowUsingLinearAnimation(); 38 | } 39 | 40 | private void mostatilCard_ClickedViewProject(object sender, RoutedEventArgs e) 41 | { 42 | NavigateTo(project1); 43 | } 44 | 45 | private void compressCard_ClickedViewProject(object sender, RoutedEventArgs e) 46 | { 47 | NavigateTo(project2); 48 | } 49 | 50 | private void treapCard_ClickedViewProject(object sender, RoutedEventArgs e) 51 | { 52 | NavigateTo(project3); 53 | } 54 | 55 | private void mazeCard_ClickedViewProject(object sender, RoutedEventArgs e) 56 | { 57 | NavigateTo(project4); 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /GuilanDataStructures/Projects/Project1/BoresheMostatil.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | These rectangles are visual preview of your input: 36 | 43 | 48 | 53 | 58 | 59 | 60 | 61 | Input(split with spaces): 62 | 67 | 5 4 3 2 1 68 | 69 | 70 | Area of greatest rectangle: 71 | 77 | 0 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /GuilanDataStructures/Projects/Project1/BoresheMostatil.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using GuilanDataStructures; 16 | 17 | namespace GuilanDataStructures.Projects.Project1 18 | { 19 | /// 20 | /// Interaction logic for BoresheMostatil.xaml 21 | /// 22 | public partial class BoresheMostatil : Page 23 | { 24 | public BoresheMostatil() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | #region Code Area :: Draw Graphical Rectangles 30 | private void DrawVisualRectangles(string[] token = null) 31 | { 32 | try 33 | { 34 | visualView.Children.Clear(); 35 | 36 | // If there is no data 37 | if (token == null || token[0] == string.Empty) 38 | { 39 | // Create a simple text message to display there is no data to draw 40 | var inputIsEmpty = new TextBlock() 41 | { 42 | HorizontalAlignment = HorizontalAlignment.Center, 43 | VerticalAlignment = VerticalAlignment.Center, 44 | Text = "No data to visualize!", 45 | Foreground = Brushes.DodgerBlue 46 | }; 47 | visualView.Children.Add(inputIsEmpty); 48 | } 49 | // If there is data to draw 50 | else 51 | { 52 | // Create a simple text message to display rectangles are being drawn 53 | var rendering = new TextBlock() 54 | { 55 | HorizontalAlignment = HorizontalAlignment.Center, 56 | VerticalAlignment = VerticalAlignment.Center, 57 | Text = "Drawing...", 58 | Foreground = Brushes.DodgerBlue 59 | }; 60 | 61 | var rects = new List(); 62 | 63 | int[] numbers = new int[token.Length]; 64 | 65 | // Parse all string values to integer ones 66 | numbers = Array.ConvertAll(token, int.Parse); 67 | 68 | // Finding maximum height. Needed to calculate height rectangles can fit to the viewport 69 | int maxHeight = numbers.Max(); 70 | 71 | double maximumView = visualView.ActualHeight; 72 | 73 | double ratio = maximumView / maxHeight; 74 | 75 | // Add rectangles one by one 76 | for (int i = 0; i < token.Length; i++) 77 | { 78 | rects.Add(new Rectangle() 79 | { 80 | Height = (double.Parse(token[i]) * ratio), 81 | Width = 20, 82 | VerticalAlignment = VerticalAlignment.Bottom, 83 | Stroke = Brushes.Gray 84 | }); 85 | } 86 | visualView.Children.Remove(rendering); 87 | foreach (var rect in rects) visualView.Children.Add(rect); 88 | 89 | } 90 | } 91 | catch (Exception ex) 92 | { 93 | visualView.Children.Clear(); 94 | 95 | // Create a simple text message to display there is an error in your input 96 | var errorDrawing = new TextBlock() 97 | { 98 | HorizontalAlignment = HorizontalAlignment.Center, 99 | VerticalAlignment = VerticalAlignment.Center, 100 | Foreground = Brushes.DarkRed, 101 | Text = "Error in drawing shapes." 102 | }; 103 | visualView.Children.Add(errorDrawing); 104 | } 105 | 106 | } 107 | #endregion 108 | 109 | private void CalculationProcess() 110 | { 111 | try 112 | { 113 | string[] token = inputTextBox.Text.TrimStart(' ').TrimEnd(' ').Split(' '); 114 | int tokenLen = token.Length; 115 | 116 | // Async operation to draw visual rectangles using a single-thread async task 117 | Task.Run(() => 118 | { 119 | Dispatcher.Invoke(() => { DrawVisualRectangles(token); }); 120 | }); 121 | 122 | int maxArea = CalculateMaximumArea(Array.ConvertAll(token, int.Parse)); 123 | 124 | resultTextBox.Background = Brushes.White; 125 | resultTextBox.Text = maxArea.ToString(); 126 | 127 | } 128 | catch (Exception ex) 129 | { 130 | try 131 | { 132 | resultTextBox.Background = Brushes.LightPink; 133 | resultTextBox.Text = "Error in calculations."; 134 | } 135 | catch { } 136 | 137 | } 138 | } 139 | 140 | private void TextBox_TextChanged(object sender, TextChangedEventArgs e) 141 | { 142 | if(inputTextBox.Text == string.Empty) 143 | { 144 | resultTextBox.Background = Brushes.LightYellow; 145 | resultTextBox.Text = "Please input a value."; 146 | 147 | // Dispaly there is no data to preview in viewport 148 | Task.Run(() => 149 | { 150 | Dispatcher.Invoke(() => { DrawVisualRectangles(null); }); 151 | }); 152 | 153 | } 154 | else CalculationProcess(); 155 | 156 | } 157 | 158 | private int CalculateMaximumArea(int[] heights) 159 | { 160 | // Stack to hold Index to Values 161 | var stack = new Stack(); 162 | 163 | // Number of elements in Heights Array 164 | var count = heights.Length; 165 | 166 | // Result to be returned 167 | int result = 0; 168 | 169 | // Itrate in heights 170 | int itrator = 0; 171 | 172 | while(itrator < count) 173 | { 174 | /* 175 | * Index of Itrator should be pushed in stack in only two conditions: 176 | * 1- Stack is empty 177 | * 2- Heigh of current item is higher than element with index of top of the stack 178 | */ 179 | if (stack.IsEmpty() || heights[itrator] >= heights[stack.Peek()]) stack.Push(itrator++); 180 | /* 181 | * If none of above conditions are true, it's time to calculate created areas 182 | */ 183 | else 184 | { 185 | int popedValue = stack.Pop(); 186 | 187 | int calculationFactor = (stack.IsEmpty()) ? itrator : (itrator - stack.Peek() - 1); 188 | 189 | int area = heights[popedValue] * calculationFactor; 190 | 191 | if (area > result) result = area; 192 | 193 | } 194 | } 195 | // Recalculate un-empty stack using method above in "else" block 196 | while (!stack.IsEmpty()) 197 | { 198 | int popedValue = stack.Pop(); 199 | 200 | int calculationFactor = (stack.IsEmpty()) ? itrator : (itrator - stack.Peek() - 1); 201 | 202 | int area = heights[popedValue] * calculationFactor; 203 | 204 | if (area > result) result = area; 205 | } 206 | 207 | return result; 208 | } 209 | 210 | private void resultTextBox_Loaded(object sender, RoutedEventArgs e) 211 | { 212 | // Initialize example text 213 | inputTextBox.Text = "5 4 3 2 1"; 214 | CalculationProcess(); 215 | } 216 | 217 | private void visualView_SizeChanged(object sender, SizeChangedEventArgs e) 218 | { 219 | string[] token = inputTextBox.Text.TrimEnd(' ').Split(' '); 220 | int tokenLen = token.Length; 221 | 222 | Task.Run(() => 223 | { 224 | Dispatcher.Invoke(() => { DrawVisualRectangles(token); }); 225 | }); 226 | 227 | } 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /GuilanDataStructures/Projects/Project2/CharFrequency.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /GuilanDataStructures/Projects/Project2/CharFrequency.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace GuilanDataStructures.Projects.Project2 17 | { 18 | /// 19 | /// Interaction logic for CharFrequency.xaml 20 | /// 21 | public partial class CharFrequency : UserControl 22 | { 23 | 24 | public bool IsBlue { get; set; } 25 | public char Character { get; set; } 26 | public int Frequency { get; set; } 27 | 28 | public CharFrequency(char c, int f, bool isBlue) 29 | { 30 | 31 | Character = c; Frequency = f; IsBlue = isBlue; 32 | 33 | InitializeComponent(); 34 | 35 | @char.Text = Character.ToString(); 36 | freq.Text = Frequency.ToString(); 37 | 38 | if (IsBlue) 39 | { 40 | outerBorder.Background = Brushes.LightBlue; 41 | outerBorder.BorderBrush = Brushes.DodgerBlue; 42 | innerBorder.BorderBrush = Brushes.DodgerBlue; 43 | 44 | @char.Foreground = Brushes.DodgerBlue; 45 | freq.Foreground = Brushes.DodgerBlue; 46 | 47 | } 48 | else 49 | { 50 | outerBorder.Background = Brushes.PaleVioletRed; 51 | outerBorder.BorderBrush = Brushes.DarkRed; 52 | innerBorder.BorderBrush = Brushes.DarkRed; 53 | 54 | @char.Foreground = Brushes.DarkRed; 55 | freq.Foreground = Brushes.DarkRed; 56 | } 57 | 58 | } 59 | 60 | private void Border_ContextMenuClosing(object sender, ContextMenuEventArgs e) 61 | { 62 | 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /GuilanDataStructures/Projects/Project2/CompressedText.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Please select input type: 35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | Write text in the built-in editor 47 | 48 | 52 | Read text from a file 53 | 54 | 55 | 65 | 66 | 67 | 71 | 77 | 83 | Input a text for decompressing with Huffman Tree method: 84 | 85 | 86 | 90 | 100 | 101 | 102 | 106 | 107 | 108 | 109 | 110 | 116 | 122 | 123 | 124 | Text Compress: 125 | 126 | 130 | 131 | 132 | 133 | 134 | 140 | 146 | 147 | 55 | 56 | 57 | Decompress text: 58 | 59 | 64 | 65 | 66 | 67 | 68 | 74 | 80 | 81 |