George Mamaladze

.NET C# tips, tricks, tweaks. Effective use of data structures and algorithms. Clean code.
posts - 11 , comments - 24 , trackbacks - 0

Data Structures and Algorithms

The story of QuadTree perforamnce optimization
Download QuadTreeOptimization.zip c# project Background Today I'd like to share with you interesting experiences I made last several evenings when working on one of my open source hobby projects - Source Code Cloud Generator http://sourcecodecloud.code... One of the tasks was arranging of nonintersecting rectangles on a 2D surface in certain pattern. For quick 2D collision detection (rectangle intersection) I decided to use QuadTree data structure [see: http://en.wikipedia.org/wik... ......

Posted On Wednesday, July 20, 2011 10:05 AM | Comments (2) | Filed Under [ Data Structures and Algorithms ]

Why .NET LinkedList does not support Concat and Split operations?
Why .NET LinkedList does not support Concat and Split operations? Download SimpleLinkedList source code Concat O(1) or O(n) ? The .NET LinkedList is a circular doubly linked list, where each node holds a reference to its previous and next nodes. The last node’s next is the head node and the head node’s previous is the last one. Linked lists are attractive because of O(1) insertion and removal operations. Instead of shifting elements in array you just chain nodes in appropriate order and that’s it. ......

Posted On Monday, July 18, 2011 12:55 AM | Comments (2) | Filed Under [ Data Structures and Algorithms ]

Implementing the Equals Method in .NET and … Linear Algebra
As an informatics student you learn hundreds of mathematical definitions and theorems and all of them seem to be useless programming. Here the evidence from the “real programmer life” to demonstrate you that’s not true. I was asked to analyze some very strange behaving class. The Contains(object obj) method was not working correctly on after populating the list with instances of this class. The problem was a mess implementation of bool Equals(Object obj) overloaded methods. There was no logical or ......

Posted On Saturday, November 27, 2010 11:21 PM | Comments (0) | Filed Under [ Data Structures and Algorithms ]

Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value
Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value Recently I gave a group of developers a task witch can be simplified to following simple problem: you have a sorted array of elements; find the index of a given element in this array. They came up with following solution: //given array int[] sortedArray = new[] { 1, 5, 8, 12, 18, 20 }; //Create a list from the array List<int> list = new List<int>(sortedArray); //use IndexOf ......

Posted On Tuesday, February 2, 2010 12:57 AM | Comments (0) | Filed Under [ Data Structures and Algorithms ]

Powered by: