N Queens Recursive Algorithm With Multi Threading Essay

1839 words - 8 pages

Now we place the 3rd queen in the available column. Here again, we don’t have a place to put the fourth queen. So we back track to
the first queen and change its position to the second column as shown in Fig.7 below.

Fig. 7 Placement of three queens

As, shown in the Fig. 8 below, for the 2nd queen we only have one place to put it on the chessboard.

Fig. 8 Placement of first queen with next column after backtracking
After placing the 2nd queen, the available options for next queen are shown below.

Fig. 9 Placement of two queens with different positions

Again, after placing third queen, the available option is as shown in Fig. 10 below.

Fig. 10 Placement of three queens with varying positions

After placing all queens one of the possible solution will look like the diagram shown below.

Fig. 11 One solution of all queens placed
We will repeat all the above steps to find another solution for the 4-queen problem. This whole process is shown in below diagram.

Fig. 12 Complete process tree for 4 queens placement

The data I have gathered is in the form of execution time required to find all possible unique solutions for a given number of queens. I have used two time stamps to find the actual execution time required for this serial algorithm. I have placed one timestamp named as 'start' at the beginning of the function and one timestamp named as 'end' after completion of this function. Then I have calculated the total execution time to find all solutions by simply taking the difference between these two values. I have used the 'Netbeans IDE ' profiler to run the program and collect the data. After collecting this data I have redirected these results to the respective log files. I have iteratively performed the same process by increasing the number of queens by one in each iteration upto 18.
Because of the recursive and backtracking nature of this algorithm, the execution time increases gradually as the number of queens increase.
In order to reduce the execution time we need to parallelize the problem in such a way that the original problem is divided into sub-problems. These individual sub-problems can be executed in parallel using multiple threads.

2.2. Proposed Multi-threading approach

2.2.1 Time Slice for threads more than cores

Allow me to explain the basics of threading first. A thread is essentially a single sequence of instructions[10]. A process contains one or more threads. It is nothing but an instance of the program. Therefore, threads and cores are directly related to each other. For the operating system(OS), a thread is a unit of work which can be scheduled to execute on a single core[10].
Time division multiplexing is a type of technique which generally used by the operating system to make a single core able to run multiple threads. The OS sets up a timer which interrupts the system at a fixed interval[10]. A single interval is known as a time slice. At the occurrence of this interrupt, the OS...

Find Another Essay On N-Queens Recursive Algorithm with Multi-threading

Proposal of a New Sorting Algorithm

1809 words - 7 pages objective to propose a new sorting algorithm i.e. Relative Split and Concatenate Sort, analyses of complexity and running time with some of the existing sorting algorithms. This sorting algorithm lies under the class of algorithms having O(n²) complexity. Author believes this algorithm will contribute a bit more in the existing of computation. III. LITERATURE REVIEW A number of sorting techniques are currently used in the field of computer

Distance Protection Algorithm for Three Terminal Transmission Lines Using Local Measurement

1420 words - 6 pages 16th Power Systems Computation Conf., Glasgow, 2008, CD-ROM. [7] M. Abe, T. Emura, N. Otsuzuki, and M. Takeuchi, “Development of a new fault location system for multi-terminal single transmission lines,” IEEE Trans. Power Del., vol. 10, no. 1, pp. 159–168, Jan. 1995. [8] T. Nagasawa, M. Abe, N. Otsuzuki, T. Emura, Y. Jikihara, and M. Takeuchi, “Development of a new fault location algorithm for multi-terminal two parallel transmission lines

Quantifying the End-to-End Delay Performance in Multihop Wireless Networks

3684 words - 15 pages networks,” IEEE/ACM Trans. Netw., vol. 14, no. 2, pp. 302–315, Apr. 2006. [9] C. Joo, X. Lin, and N. B. Shroff, “Understanding the capacity region of the greedy maximal scheduling algorithm in multi-hop wireless networks,”IEEE/ACM Trans. Netw., vol. 17, no. 4, pp. 1132–1145, Aug2009. [10] L. Bui, R. Srikant, and A. L. Stolyar, “Novel architectures and algorithms for delay reduction in back-pressure scheduling and routing,”in Proc. IEEE INFOCOM Mini

Backward Substraction Algorithm for Stationary and Dynamic Background Video Sequences

1786 words - 8 pages algorithm usually adopts the method of image averaging to build the background model, which averages multi-frames after summing them up to get a new image. This method is simple and easy to be implemented, but the averaging image is too fuzzy, which will definitely affect the accuracy of video object segmentation. Hong Qiang Bao proposed a video object segmentation algorithm based on background reconstruction. This

Multi-objective Reconfiguration of Electrical Distribution Networks

2532 words - 10 pages , and branch current constraint violations. In Ref. [29] a fuzzy optimization scheme is put forward for multi objective reconfiguration of EDSs using honey bee mating optimization, i.e. HBMO algorithm. In Ref. [30] another fuzzy multi objective technique is suggested for network configuration using GA. There are also hybrid meta-heuristic approaches merged with fuzzy sets theory such as (ACO-PSO) [31], (PSO-HBMO) [32] propounded to solve the

Automated_Software_Test_Data_Optimization_Using_AI (IS-II Short Report)Arshad_087104

4155 words - 17 pages validate a technique of AI that uses genetic algorithm for the optimization of software test data. A genetic algorithm emerges from the evaluation of natural species in searching for the optimal solution to a problem. In this paper authors have used multi objective genetic algorithm for implementing the proposed algorithm. For this purpose, Authors have chosen NSGA (Non-Dominated Sorting Genetic Algorithm). It is a very effective algorithm and has

multiple object segmantation

603 words - 3 pages of the multiple objects. Kalman filter is used in a wide range of engineering and econometric application from radar and computer vision to estimation of structural macroeconomic models, and is an important topic in control theory and control systems engineering.[11] The Kalman filter is the linear-quadratic regulator. It is also an optimal recursive data processing algorithm. In image sequence processing kalman filtering is used for an adaptive

Advanced Adaptive Particle Swarm Optimization based SVC Controller for Power System Stability

1240 words - 5 pages is based on the fusion of the PSO, Clonal Selection Algorithm, and Mind Evolutionary Computation. An Ant Colony Optimization based clustering algorithm was introduced by Sheokar [10]. Jin-Zhu Hu has explained the algorithm of PSO with dynamic inertia weight in paper [18].Complex ELD problem has been solved by BF with PSO biased evaluation in which directed velocity based on the global best location (gbest particle of PSO) is added with the

Introducing SMART Antennas to improve throughput

1320 words - 6 pages derived from original array with a translation invariance structure.[2] • Root-MUSIC Polynomial version of MUSIC algorithm. • MVDR – Minimum Variance Distortion-less Response algorithm Aim of this algorithm is to minimize the power contributed by noise and any signals coming from the interferer. Beamforming Algorithms There are two types of beamforming techniques. They are switched beam and adaptive array system. Switched beam techniques use

TLBO ALgorithms and Optimization

977 words - 4 pages TLBO. The detailed diagram of TLBO is shown in fig. 1 [15]. However, Conceptual framework (or synoptic representation) of TLBO algorithm is shown in fig. 2. In the entire process, TLBO tries to shift mean towards best. Nowadays, multi-core CPUs are getting common and cheaper. One cannot ignore their importance anymore. With the recent advancement of multi-core system, researchers have been modifying EAs for parallel implementation on a multi-core

A Review on Vrious Digital Image Ecryption Techniques

2431 words - 10 pages Conference on 10-12 July 2012, pages: 68-73. [10] Hazem Mohammad Al-Najjar, “Digital Image Encryption Algorithm Based on Multi-Dimensional Chaotic System and Pixels Location”, International Journal of Computer Theory and Engineering, Vol. 4, No. 3, June 2012 [11] Dattatherya, S. Venkata Chalam & Manoj Kumar Singh, “Unified Approach with Neural Network for Authentication, Security and Compression of Image: UNICAP”, International Journal of Image

Similar Essays

Enhancements Of The Software For Time Performance Analysis Of Recursive Algorithms

1075 words - 5 pages Efficiency Analysis in an Algorithms Course, WORLDCOMP'11 – FECS, Proc. of the 2011 Int. Conf. on Frontiers in Education: Computer Science & Computer Engineering, (Ed. Arabnia, Clincy), Las Vegas, NV, SCREA Press, 373-379. [4] Pevac, I. (2012). First Experiences with Tutor for Recursive Algorithm Time Efficiency Analysis. The Journal of Computing Sciences in Colleges, 28(1), 56-65.

Efficient Channel Estimation Method For Mimo Ofdm System

1753 words - 8 pages -1) (14) Where 0

Implementation Of Efficient Channel Estimation Method

2305 words - 9 pages power = ∑_(k=0)^(M-1)▒〖E〖[|U(n-k)|]〗^2 〗.The structure of transversal filter component is shown in Fig.3updating the weight. From this figure you have observe that every tap input is multiplied by the filter tap weight and it is summed to produce y(n) which is subtracted from the desire signal d(n) resulting in error e(n). RECURSIVE LEAST SQUARE Recursive Least Square is an algorithm which recursively finds the filter coefficients that minimize

Investigation Of Insertion Sort Essay

1824 words - 7 pages from the bottom up through every element to be inserted at the correct place. (Cutter, P. and Schultz, K. 2004:114) Recursive Insertion Sort Description Recursive insertion works exactly the same as the normal insertion sort but, within the method the method name is called while n decreases with one every time. This makes it go through the loop while searching for the correct spot. So instead of having a for loop that goes through
Watch movie | Eugene Lipinski | luissuarez9