Efficient array for solving sudoku problem

In Knuth’s example of Dancing Links and Algorithm X (DLX), pointers were used to connect the neighbors with each other. This has caused problems when DLX is used for parallelisation and to solve this some workaround is needed. One solution is to store the pointers as indicesin an array instead. The...

Full description

Bibliographic Details
Main Author: Foroutan Rad, Aria
Format: Others
Language:English
Published: Umeå universitet, Institutionen för datavetenskap 2018
Subjects:
Online Access:http://urn.kb.se/resolve?urn=urn:nbn:se:umu:diva-155407
Description
Summary:In Knuth’s example of Dancing Links and Algorithm X (DLX), pointers were used to connect the neighbors with each other. This has caused problems when DLX is used for parallelisation and to solve this some workaround is needed. One solution is to store the pointers as indicesin an array instead. The purpose of this thesis is therefore answer how a solution based on indices compares time wise to a solution with pointers. A comparison was made by implementing two versions of DLX, one with pointers and one with indices. Each version was then used to solve sudoku puzzles and the time taken was measured. The result of this was that the representations had similar complexity but the representation with indices fell behind since each recursion took longer time compared to the representation with pointers. Therefore parallelisation is needed to put the representation with indices up to par with the represnetation with pointers. === I Knuths exempel av Dancing Links och Algorithm X (DLX) användes pekare för att koppla ihop grannar med varandra. Problemet med denna lösning är att när DLX ska parallelliseras är det inte möjligt att använda sig av samma pekare. Istället måste en alternativ lösning hittas för detta problem och en lösning är att använda index i en array. Denna rapport kommer därmed ge ett svar på hur snabb en lösning med index är jämförtmed en representation med pekare genom att implementera två versioner av DLX, en med pekare och den andra med index. Resultatet av detta var att representationerna hade liknande komplexitet men array representationen tog längre tid än representationen med pekare eftersom att varje rekursion tog längre tid. Parallellisering behövs därav för att göra array representationen lika snabb som representationen med pekare.