This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Szymon Romik
committed
Jul 9, 2020
1 parent
bb6326e
commit bcdaba8
Showing
9 changed files
with
563 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
find_words |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Makefile for finding words examples | ||
# | ||
OBJS = find_words.o | ||
LIBS = -lpmemobj -lpmem | ||
|
||
all: find_words | ||
|
||
find_words: $(OBJS) | ||
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LIBS) | ||
|
||
clean: | ||
$(RM) *.o core a.out | ||
|
||
clobber: clean | ||
$(RM) find_words | ||
|
||
.PHONY: all clean clobber | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
C++ data structures in persistent memory | ||
|
||
In this example, we will solve a simple algorithmic problem using data | ||
structures which resides in persistent memory. We will use persistent containers | ||
from libpmemobj-cpp library. | ||
|
||
C++ programmers will get the most out of this example. | ||
|
||
This is example consists of these files: | ||
|
||
dictionary.txt -- a file with some words which represents a dictionary | ||
board.txt -- a file with characters in a form of 2D matrix | ||
Makefile -- rules for building all the programs in this example | ||
trie.hpp -- a simple trie structure implementation for persistent | ||
memory | ||
find_words.cpp -- C++ program for finding words, program can continue | ||
search process after the crash happen | ||
run.sh -- run the find_words example | ||
|
||
To build the program in this example run: make | ||
To run it, use the run.sh script. | ||
|
||
Modifying the code and run steps is a great way to learn from this example. | ||
|
||
In this example we are given a problem to solve: | ||
In a 2-D matrix of characters (board.txt) we must find all the words from a | ||
dictionary (dictionary.txt). Words can be formed from the adjecent cells (left, | ||
right, top, bottom), each cell can be used only once when creating a single | ||
word. | ||
|
||
We will solve this problem, creating trie and performing DFS from every board | ||
cell, saving current results in on a persistent memory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
metep | ||
ensrx | ||
mtisx | ||
oryxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
persistent memory and nothing else |
Oops, something went wrong.