Git Product home page Git Product logo

word-transformation's Introduction

Transformation between strings ( C++ )

Description

Transformation of a string from source to destination using only 4 possible operations. Add a charactrer, Delete a character, Replace a character, Replace with anagram. The cost of each operation is given as an input.

Input : Associated cost with each of the above operations : Say : n1 n2 n3 n4 or 1 3 4 5 The source and destination strings

Output : The cost of transforming one word to another or "-1" if it's not possible

Assumptions : ( According to the sample test cases given in the challenge )
1] Minimum length of each interim word is 3
2] Each word consists of only "CAPITAL" letter (26 in number), if incorperating other ASCII characters the code can be changed accordingly
3] The weight of each edge is positive ( no negative egde weights or cycles ). This is required to apply dijkstra's algorithm

Directory Structure :

headers - Dictionary.h, Graph.h ( Class definitions )
sources - main.cpp,Dictionary.cpp, Graph.cpp ( Main program and class implementations )
README.txt - read this file for usage before execution
out - Executable file

Usage:

1] :$command_prompt: make
If out is up-to-date use :
$command_prompt: ./out

2] Enter the cost of each of the four operations in order:
( Separate them by spaces )
Add a letter
Delete a letter
Change a letter
Take an anagram of existing word
Ex: 1 3 4 5

3] Enter the source word
HEALTH
4] Enter the destination word
HANDS

5] Output is displayed. Two cases:
a) Shortest cost path from source to destination
b) '-1' if there is no existing path

word-transformation's People

Contributors

girishbathala avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.